Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / Case sensitivity

Author
Message
Mike Johnson
TGC Developer
21
Years of Service
User Offline
Joined: 13th Sep 2002
Location: United Kingdom
Posted: 21st Jan 2011 11:02
This is another topic that has been brought. What are peoples thoughts on this? In favour or not?
Van B
Moderator
21
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 21st Jan 2011 11:07
Not +1

I like the option of having commands in lowercase or uppercase, often I add experimental or temporary code in uppercase so I can find it easily.

Health, Ammo, and bacon and eggs!
C0wbox
17
Years of Service
User Offline
Joined: 6th Jun 2006
Location: 0,50,-150
Posted: 21st Jan 2011 11:31 Edited at: 22nd Jan 2011 14:15
Not +1

For the same reasons as Van B.

I also like to have all my variables in uppercase so that when I want to Ctrl+R (Replace) the name of one, I can set it to match case and change the case for all the variables and not ordinary words or things in comments.


EDIT:
After careful consideration I've changed my mind to "I don't mind".

baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 21st Jan 2011 11:39
Not +1

Changing my mind about a lot of these questions the more I think about it.

C0wbox and VanB give two very good reasons why not. I personally think it makes it less likely to make mistakes / replicated variables but if the IDE is like Visual Studio and variables needed to be declared then this wouldn't be as much as a problem...

C0wbox
17
Years of Service
User Offline
Joined: 6th Jun 2006
Location: 0,50,-150
Posted: 21st Jan 2011 11:49
I've briefly used Java as well as C++ and Java kicked up a hell of a lot more fuss about case sensitivity. It put me off the language (same with the rest of the people in the room trying it) so I feel it may have the same effect if it were done to AGK.

Hodgey
14
Years of Service
User Offline
Joined: 10th Oct 2009
Location: Australia
Posted: 21st Jan 2011 12:17
Another vote for NOT case sensitive

Quote: "I like the option of having commands in lowercase or uppercase"


I couldn't agree more

A clever person solves a problem, a wise person avoids it - Albert Einstein
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 21st Jan 2011 12:20
Yes +1.

With all commands cased like LoadImage.

I find the arguments against sensitivity unconvincing - and case insensitivity encourages very sloppy unreadable code such as



Are we dealing with three variables or one? When I read code like that I'm never sure what's intended.

Some of the arguments suggested above have nothing to do with case insensitivity. For example you can have all your variables upper or lower or mixed as long as you are consistent, i.e. the above snippet is perfectly acceptable if your intention really is to have three distinct variables.

Why on earth would anyone need to use MYvariable in one place and myVariable somewhere else for the same variable? Sloppy habits should be actively discouraged.
Scraggle
Moderator
20
Years of Service
User Offline
Joined: 10th Jul 2003
Location: Yorkshire
Posted: 21st Jan 2011 12:21
A definite no from me!

IanM
Retired Moderator
21
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 21st Jan 2011 13:31 Edited at: 21st Jan 2011 13:32
I can work with either, but I have to note that DBPro is the only one that is actually case-insensitive, and being so makes it no easier or harder than the other languages I use.

If the IDE autocorrects the case, then I'll happily go with a case-insensitive compiler. Otherwise, I'd prefer it to be case-sensitive.

Another option is both - have it as an in-source compiler mode switch.

[edit]Actually, if you count SQL then I use two.

dark coder
21
Years of Service
User Offline
Joined: 6th Oct 2002
Location: Japan
Posted: 21st Jan 2011 14:09
I agree with what Green Gandalf has said to the letter, though I personally don't mind either way. As long as you know how to type, and your IDE has auto-complete then it's pretty hard to get the case or spelling wrong.


Quote: "If the IDE autocorrects the case, then I'll happily go with a case-insensitive compiler."


I'm not sure I understand, surely if the IDE auto-corrected the case then there would be no need for the compiler to be case-insensitive?

IanM
Retired Moderator
21
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 21st Jan 2011 14:29
You're right, with what I've written, but I meant if the case correction was a user-selected option within the IDE.

bitJericho
21
Years of Service
User Offline
Joined: 9th Oct 2002
Location: United States
Posted: 21st Jan 2011 14:40
Quote: "You're right, with what I've written, but I meant if the case correction was a user-selected option within the IDE.
"


Case insensitive for sure.

And IDE options for selecting case would be awesome!

I like to have my commands in all caps, and variables all lowercase, how Qbasic used to be

[center]
Join the TGC Group!
http://tehcodez.groups.live.com
thenerd
15
Years of Service
User Offline
Joined: 9th Mar 2009
Location: Boston, USA
Posted: 21st Jan 2011 15:38
I'd say Case-insensitive, but have a feature in the editor to automatically correct case in variables if they have already been declared earlier in the file.

Van B
Moderator
21
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 21st Jan 2011 15:44
Yeah, an autofill would make all the difference. We're talking about 2 different things though really, case sensitivity on commands, and case sensitivity on variables. I'm sticking to my guns anyway - with autofill the commands would be formatted anyway, and with variables I would hope that Myvar, MYvar, and MYVAR were all the same thing.

Health, Ammo, and bacon and eggs!
swissolo
14
Years of Service
User Offline
Joined: 9th Jan 2010
Location:
Posted: 21st Jan 2011 15:50
Case-insensitive

swis
Fatal Berserker
13
Years of Service
User Offline
Joined: 2nd Jul 2010
Location:
Posted: 21st Jan 2011 21:54
I agree with green gandalf.
It will make for extremely untidy programming.
So sensitive.

LeeBamber
TGC Lead Developer
24
Years of Service
User Offline
Joined: 21st Jan 2000
Location: England
Posted: 21st Jan 2011 22:33
Sounds like the solution is a case insensitive compiler and an editor which can optionally correct case when writing the code in order to produce a standard 'suggested' flavour. By this I mean you can type in any case you like, i.e.

DIM ( lee[100] )
Lee[12] = 999
print ( LEE[12] )
WAITKEY()

And as you finish each line, if the editor is defined, it will auto-correct to look like:

Dim ( lee[100] )
lee[12] = 999
Print ( lee[12] )
WaitKey()

Both would compile fine, but the later looks nicer and easier for someone else to read. I have assumed the editor style is set for capital letters for commands and lower case for variables. The editor would also syntax highlight in a favourable colour too so we get the best chance of quickly reading code from other programmers.

I drink tea, and in my spare time I write software.
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 21st Jan 2011 22:51
I could live with that.

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.

Case sensitivity would have stopped that. And I see absolutely no reason other than sheer sloppiness or laziness for code to resemble your first snippet.
LeeBamber
TGC Lead Developer
24
Years of Service
User Offline
Joined: 21st Jan 2000
Location: England
Posted: 21st Jan 2011 22:56
Good point GG! There will be a compiler flag which ensures that all variables are pre-declared before the application can run, so the 'ii' vs 'II' scenario would be detected and reported before you enter the two hour world of aimless wondering in the land of debug.

I drink tea, and in my spare time I write software.
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 21st Jan 2011 22:59
Good.
IanM
Retired Moderator
21
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
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.

Diggsey
17
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 21st Jan 2011 23:23
I'm happy with that as a solution

[b]
Kevin Picone
21
Years of Service
User Offline
Joined: 27th Aug 2002
Location: Australia
Posted: 22nd Jan 2011 02:29 Edited at: 22nd Jan 2011 14:06
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.



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.

C0wbox
17
Years of Service
User Offline
Joined: 6th Jun 2006
Location: 0,50,-150
Posted: 22nd Jan 2011 03:40 Edited at: 22nd Jan 2011 03:44
Quote: "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:

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:


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.

SH4773R
14
Years of Service
User Offline
Joined: 18th Jan 2010
Location: AMERICA!!!
Posted: 22nd Jan 2011 05:12
I'll vote no on case sensitivity, compilers are allready plenty sensitive allready.
Brk_oth
18
Years of Service
User Offline
Joined: 8th Aug 2005
Location: Australia
Posted: 22nd Jan 2011 05:12
I vote for case insensitivity.

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

No signature found...
dark coder
21
Years of Service
User Offline
Joined: 6th Oct 2002
Location: Japan
Posted: 22nd Jan 2011 06:57 Edited at: 22nd Jan 2011 06:58
Quote: "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."


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.


Quote: "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.

C0wbox
17
Years of Service
User Offline
Joined: 6th Jun 2006
Location: 0,50,-150
Posted: 22nd Jan 2011 07: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.

DMXtra
21
Years of Service
User Offline
Joined: 28th Aug 2002
Location: United States
Posted: 22nd Jan 2011 08:11
No case sensitive please

Dark Basic Pro - The Bedroom Coder's Language of choice for the 21st Century.
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 22nd Jan 2011 12:23
Quote: "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.

Quote: "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.

Quote: "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

Quote: "
+ Code Snippet
MyVaribale=45

print myVariable


Otherwise 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?
bitJericho
21
Years of Service
User Offline
Joined: 9th Oct 2002
Location: United States
Posted: 22nd Jan 2011 13:11 Edited at: 22nd Jan 2011 13:11
Quote: "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!)

[center]
Join the TGC Group!
http://tehcodez.groups.live.com
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
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.

Quote: "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.
Diggsey
17
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 22nd Jan 2011 13:36 Edited at: 22nd Jan 2011 13:37
Quote: "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!

[b]
Scraggle
Moderator
20
Years of Service
User Offline
Joined: 10th Jul 2003
Location: Yorkshire
Posted: 22nd Jan 2011 13:51 Edited at: 23rd Jan 2011 14:07
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:


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.

Fatal Berserker
13
Years of Service
User Offline
Joined: 2nd Jul 2010
Location:
Posted: 22nd Jan 2011 13:52
Quote: "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.

Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 22nd Jan 2011 13:57
Quote: "Never used the debugger in Visual Studio?"


No.

Quote: "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.
Kevin Picone
21
Years of Service
User Offline
Joined: 27th Aug 2002
Location: Australia
Posted: 22nd Jan 2011 14:09
Quote: "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.

C0wbox
17
Years of Service
User Offline
Joined: 6th Jun 2006
Location: 0,50,-150
Posted: 22nd Jan 2011 14:14
Quote: "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.

Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 22nd Jan 2011 14:15
@Scraggle

Quote: "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.

Quote: "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?
bitJericho
21
Years of Service
User Offline
Joined: 9th Oct 2002
Location: United States
Posted: 22nd Jan 2011 14:18
Quote: "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)

[center]
Join the TGC Group!
http://tehcodez.groups.live.com
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 22nd Jan 2011 14:19
@Kevin Picone

Quote: "You mean apart from an obvious typo ? - Simply that case sensitivity and implicit declaration do not go together."


Ah, I see. I thought the obvious typo was deliberate.

I agree with your second sentence and have always found implicit typing to be a nuisance and a source of silly errors. Of course explicit typing is a bit of a nuisance too.
Scraggle
Moderator
20
Years of Service
User Offline
Joined: 10th Jul 2003
Location: Yorkshire
Posted: 22nd Jan 2011 14:20
GG - you seem to be suggesting that having construct and conStruct as two distinct variables is a good thing. I would have to say it isn't. It is a VERY bad thing and would be the cause of many errors.

My suggestion removes this problem and forces the user to have different variable names not just different cased version of the same name.

Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 22nd Jan 2011 14:29
Sooner or later with camel case you'll encounter the problem I described. My example just wasn't very good.

Quote: "It is a VERY bad thing and would be the cause of many errors."


Not if you use camel case consistently.

Quote: "My suggestion removes this problem and forces the user to have different variable names not just different cased version of the same name."


It doesn't - it creates a new problem. If you intended to have two integers, construct and conStruct, (I could think of a better example I'm sure) then your solution would simply replace one of them by the other. If that wasn't what the programmer intended then an error would be introduced. Far better to have the editor merely warn the programmer that they have used two similar names and let the programmer decide whether that was intentional or not.
Michael P
18
Years of Service
User Offline
Joined: 6th Mar 2006
Location: London (UK)
Posted: 22nd Jan 2011 14:32
Case sensitivity is a must. You need to maintain consistency throughout code, if its not case sensitive then your code isn't necessarily consistent.

Code completion becomes more difficult too, what case should it auto complete your variables? And what if you want to have multiple variables with the same name but different cases?

Most of the people answering these questions have been brain washed into sloppy coding by DBP. I don't understand why half these questions are being asked, as far as I'm concerned anyone with experience in developing commercial systems knows the answer is obvious.

Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 22nd Jan 2011 14:34
Yes.
Benjamin
21
Years of Service
User Offline
Joined: 24th Nov 2002
Location: France
Posted: 22nd Jan 2011 14:35
Since UnrealScript is case-insensitive and the fact that it's the best language in the world, it's only logical to make AppGameKit case-insensitive also.

Quote: "Code completion becomes more difficult too, what case should it auto complete your variables?"


It should complete it in the manner used when declaring the variable in the first place.
Scraggle
Moderator
20
Years of Service
User Offline
Joined: 10th Jul 2003
Location: Yorkshire
Posted: 22nd Jan 2011 14:36 Edited at: 22nd Jan 2011 14:38
Again you are suggesting the two variable with the same name is a good thing. I can't see any situation where it is.

Quote: "If that wasn't what the programmer intended then an error would be introduced"

The error was introduce by the programmer try to use thsame variable name twice with a different case.

Quote: "Far better to have the editor merely warn the programmer that they have used two similar names and let the programmer decide"

Having a question dialog pop up every time you miss-cased a variable name would be intensely annoying. Surely it is far better to assume that no programmer in his right mind would allow construct and conStruct to exist as two independent variables?

Quote: "what if you want to have multiple variables with the same name but different cases?"

Then you are a very bad programmer that writes code that is not mainainable. Some other programmer trying to maintain your code would be very confused.

Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 22nd Jan 2011 14:39
Why would you keep mis-casing something?

Quote: "Surely it is far better to assume that no programmer in his right mind would allow construct and conStruct to exist as two independent variables?"


As I said before, I'm sure a better example could be devised.

Quote: "Again you are suggesting the two variable with the same name is a good thing"


With case sensitivity they wouldn't be the same. Simples.
Scraggle
Moderator
20
Years of Service
User Offline
Joined: 10th Jul 2003
Location: Yorkshire
Posted: 22nd Jan 2011 14:42
Scraggle = goodProgrammer
scraggle = badProgrammer

Is there any confusion there?
Of course there is! Scraggle stills read the same as scraggle to a programmer that is new to your code and he will not thank you at all for introducing such unreadability!

Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 22nd Jan 2011 14:44
Quote: "Is there any confusion there?"


Not at all. Who is "scraggle"? Will he or she take offense?

Login to post a reply

Server time is: 2024-04-19 00:20:23
Your offset time is: 2024-04-19 00:20:23