Posted: 21st Jan 2011 23:00
Of course, predeclared variables would solve that problem simply by throwing out an error that the variable has been declared twice - should have thought of that myself.
Posted: 21st Jan 2011 23:23
I'm happy with that as a solution
Posted: 22nd Jan 2011 2:29
Making the language case sensitive and keeping 'on the run' declarations would be a nightmare for the majority of end users. If your have sensitivity then manual declaration is a must.

+ Code Snippet
       MyVariable=45

       print myVariable


Otherwise code like this, wouldn't error and you end up with two uniquely named instances.

So forget case sensitivity completely and implement an explicit declaration mode into the parser. Any stylistic preference at source code level can be handled through the IDE.
Posted: 22nd Jan 2011 3:40
And I see absolutely no reason other than sheer sloppiness or laziness for code to resemble your first snippet.


I thought I had a pretty good reason to be honest.

It's dead handy for when I wanna replace the name of a variable for being too long, too short, silly, or out of date.



Imagine you had something like this:
+ Code Snippet
// setup
sync on
sync rate 0

// make a temporary array
dim t(128)

// fill the temporary array
for i=0 to 128
 t(i)=rnd(100)
next i

// make some objects
make object cube 1,1
make object cube 2,1
 position object cube 2,10,0,0

do
 if object collision(1,2) then end
 move object right 2,rightkey()-leftkey()
 sync
loop

Then imagine you really wanted to use that temporary array for something sensible, so you Ctrl+R to replace the array name everywhere it's being used. - You'd end up with this:
+ Code Snippet
// sesomethingup
sync on
sync rasomethinge 0

// make a somethingemporary array
dim something(128)

// fill somethinghe somethingemporary array
for i=0 somethingo 128
 something(i)=rnd(100)
nexsomething i

// make some objecsomethings
make objecsomething cube 1,1
make objecsomething cube 2,1
 posisomethingion objecsomething cube 2,10,0,0

do
 if objecsomething collision(1,2) somethinghen end
 move objecsomething righsomething 2,righsomethingkey()-lefsomethingkey()
 sync
loop


Wheras if you'd made all the variables capitals, you could successfully replace all the capital Ts with capital SOMETHINGs and avoid it.



I'm not making this up, it's saved my bacon a number of times in long programs where I've wanted to rename something that I've used everywhere but clashes with keywords and comments etc.
Posted: 22nd Jan 2011 5:12
I'll vote no on case sensitivity, compilers are allready plenty sensitive allready.
Posted: 22nd Jan 2011 5:12
I vote for case insensitivity.

I do like being able to put experimental code in my programs in a different case.
Posted: 22nd Jan 2011 6:57
t's dead handy for when I wanna replace the name of a variable for being too long, too short, silly, or out of date.


I don't think assuming the average user is an idiot and would do a find/replace for the letter 't' in their whole source code is a good example of why this would be an issue. Not to mention this issue would exist regardless of the IDE or compiler's case handling.


Wheras if you'd made all the variables capitals, you could successfully replace all the capital Ts with capital SOMETHINGs and avoid it.


Case-sensitive doesn't mean your variables have to be lower case, it just means if you make a variable or function with a specific case(or indeed, combination of cases), you must use the same case in your whole code every time you use that variable or function. If you're writing the same identifier multiple ways then your code is incorrect.
Posted: 22nd Jan 2011 7:34
I was just using t as an example. I don't have any real life examples where I've used it because they've all been changed now.



And with that last part, are you saying if I had all my variables in upper case it would still work in a case sensitive language? - As long as every instance of that variable was in upper case?

If that's the case, I can live with case sensitive because within my own method, it is still case sensitive.

I just don't want to be forced to write all my variables in lower case.
Posted: 22nd Jan 2011 8:11
No case sensitive please
Posted: 22nd Jan 2011 12:23
I just don't want to be forced to write all my variables in lower case.


Noone is suggesting that - but for some very strange reason I think many posters on this thread are under that illusion.

Case sensitivity simply means that myVar and MyVar would be regarded as different variables, no more and no less.

If you're writing the same identifier multiple ways then your code is incorrect.


Or just plain careless. I really don't see why the language should be designed around that.

I do like being able to put experimental code in my programs in a different case.


You still can with case sensitivity. What do you think is wrong?

It would be a sad day for this new language if a major decision was made on the basis of a common misunderstanding.

@Kevin Picone

therwise code like this, wouldn't error and you end up with two uniquely named instances.


That is precisely what happens at the moment. What's your point exactly?
Posted: 22nd Jan 2011 13:11
However it took me a long time to realise that DBPro was case insensitive. I only realised it was when I had a lot of trouble debugging a program in which I had deliberately used variables like "ii" and "II" to mean different integers.


A working debugger would have shed light on that very quickly.

Please give us a working, and ongoing working, debugger! (and a profiler please!)
Posted: 22nd Jan 2011 13:33
I've never yet seen a Debugger that wasn't painfully laborious to use so I'd happily continue without one.

The hardest bugs to find are often caused by accidental memory over-runs which give different symptoms as soon as the debugger is invoked.

A working debugger would have shed light on that very quickly.


A simple requirement for explicit declaration of variables would have been better in that case.
Posted: 22nd Jan 2011 13:36
I've never yet seen a Debugger that wasn't painfully laborious to use so I'd happily continue without one.


Never used the debugger in Visual Studio?

The ability to step through code line by line, browse variables just by hovering over them, etc. can be very useful!
Posted: 22nd Jan 2011 13:51
I'm a bit confused as to what we are referring to as case sensitive and case insensitive. So, I will just put forward my preference:

Keywords:
I don't want to be forced to use any particular case but I would like the IDE to have options to change whatever is typed in to suit personal choice.
All lowercase: setcamerposition
All uppercase: SETCAMERAPOSITION
lower camel case: setCamerPosition
upper camel case: SetCameraPosition
My personal choice would be lower camel case but not everybody would agree, which is why I think all options should be available.

Variables/Constants/UDT's
Again I don't want to be forced to use any particular case and again I would like the IDE to change the case automatically but this time without setting any preferences. Instead they should be changed to match whatever they were declared as.
So:
+ Code Snippet
#constant TRUE 1
global myGlobalVar as integer = 1
local myLocalVar as integer = 1
myVar = myLocalVar
type tVector3
  x as float
  y as float
  z as float
endtype
myVec as tVector3


Now any future references to true, myglobalvar, mylocalvar, myvar, tvector3 and myvec will all get changed to match the case that they were either declared or first used (as is the case with the undeclared myVar).
Doing this removes the concern about myVar and myvar being two separate variables because the IDE would not allow them both to exist.
Posted: 22nd Jan 2011 13:52
The ability to step through code line by line, browse variables just by hovering over them, etc. can be very useful!


And the ability to repair the code in real time.
Posted: 22nd Jan 2011 13:57
Never used the debugger in Visual Studio?


No.

The ability to step through code line by line, browse variables just by hovering over them, etc. can be very useful!


Incredibly laborious though. I usually find that carefully placed print statements and counters are all that's needed. The hard part of debugging is usually locating the right bit of code to examine in the first place. The rest is usually trivial.

I wouldn't want my idiosyncratic view of debuggers to become policy though.
Posted: 22nd Jan 2011 14:09
That is precisely what happens at the moment. What's your point exactly?


You mean apart from an obvious typo ? - Simply that case sensitivity and implicit declaration do not go together.
Posted: 22nd Jan 2011 14:14
Case sensitivity simply means that myVar and MyVar would be regarded as different variables, no more and no less.


I changed ma mind.

I'm ok for case sensitive if that's all it does. But I won't mind if it's not case sensitive either.
Posted: 22nd Jan 2011 14:15
@Scraggle

I'm a bit confused as to what we are referring to as case sensitive and case insensitive.


It seems from several posts that you're not alone and it would be helpful if IanM, Lee or Mike came in and reminded us what the realistic options are.

Again I don't want to be forced to use any particular case and again I would like the IDE to change the case automatically but this time without setting any preferences. Instead they should be changed to match whatever they were declared as.


Without case sensitivity you have a potential problem with camel case. Suppose for example you have a variable "construct". Then later you decide to create a new variable combined from the words "con" and "struct". The obvious name for that would be "conStruct". With case sensitivity those two variables would be correctly identified as distinct - and the editor could have an option to warn you if the uncased versions of two variables are the same 9as in my example). Your solution would tell the compiler to change one of them - or alternatively tell you that the variable had already been declared which could be equally confusing. Far better to allow the user to use whichever case they wish - but insist on consistency on the part of the user.

I'm still of the view that using myVar and myvar for the same thing is just sloppy. If you use camel case then stick to it.

Why are so many people thinking that case sensitivity means that you have to use a specific casing rule?
Posted: 22nd Jan 2011 14:18
Incredibly laborious though. I usually find that carefully placed print statements and counters are all that's needed. The hard part of debugging is usually locating the right bit of code to examine in the first place. The rest is usually trivial.


Depends on the debugger. I like PB's debugger.

I click pause the execution of the program or put in a break point to pause the program at a specific spot, I open a window that lists *all* of the variables in use sorted by order.

I don't have to write any print statements, or compile 3 times because I thought of another variable to check.

I just stop execution and look at the entire state of the program. It's *awesome*

It also has a special debug output window where I can print whatever I want in a separate window. I use that to format specific veriables or groups of variables (use it just like print statements but it's in it's own special window)