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
Scraggle
Moderator
20
Years of Service
User Offline
Joined: 10th Jul 2003
Location: Yorkshire
Posted: 22nd Jan 2011 14:47 Edited at: 22nd Jan 2011 14:48
I get the impression you are arguing with me just for the sake of arguing.
Do you really believe that in a 10000 line piece of code you would instantly see that Scraggle and scraggle refer to entirely different things? Or, as I believe would happen, you would not recognise the difference in case for quite some 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 14:57
If I was using lower camel case then, yes, I'd spot the error immediately.

Similarly if I was using upper camel case.

And, with my suggestion, the editor would warn you that two variables, when uncased, are the same. Let the programmer then decide. The issue of 10000 lines is irrelevant - you only need the warning once.

The point about camel case is that each new appended word is capitalised and there are plenty of words in English which can also be constructed from two quite different words appended together. Camel case with case sensitivity allows you to distinguish the two cases (). So Scraggle/scraggle is a poor example.

Quote: "I get the impression you are arguing with me just for the sake of arguing."


Not really. I think I've exhausted what I have to say on this though.
bitJericho
21
Years of Service
User Offline
Joined: 9th Oct 2002
Location: United States
Posted: 22nd Jan 2011 14:59
just use _ instead of camel case, sheesh!

construct
con_struct

easy

[center]
Join the TGC Group!
http://tehcodez.groups.live.com
dark coder
21
Years of Service
User Offline
Joined: 6th Oct 2002
Location: Japan
Posted: 22nd Jan 2011 15:06
Why aren't the proponents of case-insensitivity also suggesting that the compiler build a database of identifiers and run some checks to see which ones were similar enough to clump together, because the user probably intended them to be the same? There is no difference between mixing your case up and spelling your variable incorrectly.

Scraggle
Moderator
20
Years of Service
User Offline
Joined: 10th Jul 2003
Location: Yorkshire
Posted: 22nd Jan 2011 15:18
Quote: "The issue of 10000 lines is irrelevant - you only need the warning once."

Not if you are maintaining someone else's code.

Scenario 1: You are handed someones 10000 line code and told to debug it.
You see myIntegerVariable and MyIntegerVariable. You are debugging a huge piece of code, it would be very easy to miss the difference.

Scenario 2: Your own code. You have myVar, myvar and MyVar.
One of them is a spaceship object another is the score and the third is screen width.
What does myVar refer to? You need a good memory if you start doing things like that.

Not having multiple variables with the same name is simple coding practice. Scraggle is still scraggle and SCRAGGLE, if they read the same, they should be treated as the same.

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 15:18
Quote: "There is no difference between mixing your case up and spelling your variable incorrectly."


My view entirely.
Scraggle
Moderator
20
Years of Service
User Offline
Joined: 10th Jul 2003
Location: Yorkshire
Posted: 22nd Jan 2011 15:24 Edited at: 22nd Jan 2011 15:25
Since not everyone is in agreement, perhaps the variable case fixing can be an IDE option. That way sensible coders that use verbose names can have their case errors auto-fixed whilst those that prefer ambiguity in their variable names can have it.

Diggsey
17
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 22nd Jan 2011 15:33 Edited at: 22nd Jan 2011 15:34
I think the point is, that if you know that the compiler is case sensitive, then there is no ambiguity...

It's perfectly clear that HellOpen and HelloPen are different variables, but if the compiler was case insensitive, it would treat them the same, causing all sorts of problems.

[b]
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 16:44
That's a better example, thanks.
Scraggle
Moderator
20
Years of Service
User Offline
Joined: 10th Jul 2003
Location: Yorkshire
Posted: 22nd Jan 2011 16:54
OK, with that example I can see a reason why you might want to do that. Personally, I think if I found myself in the need to have variables with the 'same' name like hellOpen and helloPen then I would change one of them dramatically to avoid any confusion. Therefore, I would still like the IDE option of auto-case-fix for variables.
Indigo IDE has that option for DBP and I have it set on all the time. I find it very useful.

dark coder
21
Years of Service
User Offline
Joined: 6th Oct 2002
Location: Japan
Posted: 22nd Jan 2011 17:04
How would an auto-case-fix work with HelloPen and HellOpen? Or indeed, any user created identifier. And if at least one was a global variable in a large program, then it may not be obvious that the variable name is shared, I guess forcing explicit variable declaration would make this issue harder to encounter.

Plus, if the IDE had an auto-complete feature, then it's pretty hard to get variable names or casings wrong.

Scraggle
Moderator
20
Years of Service
User Offline
Joined: 10th Jul 2003
Location: Yorkshire
Posted: 22nd Jan 2011 17:10
Quote: "How would an auto-case-fix work with HelloPen and HellOpen"

It wouldn't, which is why:
Quote: "I would change one of them dramatically to avoid any confusion"


dark coder
21
Years of Service
User Offline
Joined: 6th Oct 2002
Location: Japan
Posted: 22nd Jan 2011 17:13 Edited at: 22nd Jan 2011 17:13
Quote: "I would change one of them dramatically to avoid any confusion"


Which is why:
Quote: "And if at least one was a global variable in a large program, then it may not be obvious that the variable name is shared"


Scraggle
Moderator
20
Years of Service
User Offline
Joined: 10th Jul 2003
Location: Yorkshire
Posted: 22nd Jan 2011 17:33
Quote: "then it may not be obvious that the variable name is shared"


I wouldn't have any variables with shared names, that's the point of what I am saying. If I had a variable named hellOpen and wanted one called helloPen. Then the IDE would change helloPen to hellOpen, I would see that and change helloPen to greetingsPen.

It is possible that I might miss the IDE changing the fix-up which is why I think that variables should be explicitly declared. Then when I try to declare helloPen I would be given a "variable already exists" error. At which point it would become greetingsPen.

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 18:15
Quote: "which is why I think that variables should be explicitly declared"


That would go a long way towards solving a lot of problems, with or without case sensitivity.
IanM
Retired Moderator
21
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 22nd Jan 2011 21:16
Quote: "Who is "scraggle"? Will he or she take offense?"

Or ... she? He very well might

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

Well, I'm not sure whether anyone else really wants me to try or not, but I'll give it a go.

The basic choice is based completely on what the compiler expects. It can either be case insensitive (myvar is the same as MYVAR, as in most BASIC's including DBPro, SQL or Pascal(?) ), or not (as in C, Java, BBC BASIC).

Once that choice is made, and if you choose a case-insensitive compiler, then you have to decide how the user interacts with the compiler, and that's done via the IDE. Do you have the IDE auto-correct what the user types or not, and if it does, how it does it.

If you choose a case-sensitive compiler, then the IDE does not need to auto-correct the user (what's the point of typing in case-sensitive code that the IDE then changes for you - you may disagree with this point ).

So the three top-level choices I see are:
- Case-sensitive compiler, no IDE auto-correct.
- Case-insensitive compiler, no IDE auto-correct.
- Case-insensitive compiler, with IDE auto-correct.

If the third option is chosen, then you are into the options specified by Scraggle, which is in what way do you correct what has been entered (not repeating those options here).

Luckily for me, I'm easy with any of these options, so I'll let you all beat each other up over it

Scraggle
Moderator
20
Years of Service
User Offline
Joined: 10th Jul 2003
Location: Yorkshire
Posted: 22nd Jan 2011 21:37 Edited at: 22nd Jan 2011 21:43
No prizes for guessing where my vote lies
With the third option chosen and the IDE auto-correcting there isn't any need to decide in what way to have the IDE auto-correct. All four options could be available to the user. Then we can decide (and change our minds) whenever we want.

The four options for anyone that missed them:
All lowercase: setcameraposition
All uppercase: SETCAMERAPOSITION
lower camel case: setCameraPosition
upper camel case: SetCameraPosition

... and of course there is the fifth option which is actually option 2 from IanM's list.

That is fine for keywords. Variables would be dealt with differently and that discussion has already been thoroughly bashed out above.

Brk_oth
18
Years of Service
User Offline
Joined: 8th Aug 2005
Location: Australia
Posted: 23rd Jan 2011 00:18 Edited at: 23rd Jan 2011 00:22
If its the commands being case sensitive, then that is what I am against.
If its the variables to be case sensitive, well then I dont really care too much.

commands objectPostion and objectposition and ObjectPosition and OBJECTPOSITION should all compile.

No signature found...
Diggsey
17
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 23rd Jan 2011 01:03
I would prefer variable to be case sensitive. However, I think it's most important to have consistency of case sensitivity throughout the compiler, and I can see that everyone likes to capitalise command names differently, so it may be the best compromise to have everything case insensitive, and make the compiler require you to declare all variables exactly once, and the editor should warn you if you use the same variable name with a different case. There could also be an option in the IDE to automatically fix the casing of commands to any one of the following:
- lowercase
- uppercase
- lower camel case
- upper camel case

[b]
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 23rd Jan 2011 01:20
I think that covers everyone's main points. I'd go along with that.
Benjamin
21
Years of Service
User Offline
Joined: 24th Nov 2002
Location: France
Posted: 23rd Jan 2011 05:15
Quote: " so it may be the best compromise to have everything case insensitive, and make the compiler require you to declare all variables exactly once, and the editor should warn you if you use the same variable name with a different case"


Agreed. With explicit declaration you have the freedom of case insensitivity without the risks.

Not sure how much work it would be, but actually having an option to switch between implicit and explicit declaration would be great.
Greenster
19
Years of Service
User Offline
Joined: 3rd Feb 2005
Location: US ©
Posted: 23rd Jan 2011 11:04 Edited at: 23rd Jan 2011 11:05
Takes longer to write ReadFile than it does readfile, and this will annoy people. You're also not marketing towards open source where there is syntactical standards, but independent developers or studios who want a more powerful pipeline..
IanM
Retired Moderator
21
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 23rd Jan 2011 12:44
I refer you to my previous response re: Extra keypresses

Two-fingered typists are going to be slow no matter what.
Touch-typists have the shift key under each little finger so they're going to be fast no matter what.
For those who are somewhere in the middle, the shift-key is one of the easiest to find - certainly faster than the letters, so there's better justification for shortening commands than avoiding shift as far as speed of typing goes.

@Benjamin,
But how reasonable is it to switch? How can you can a case-sensitive function from a piece of case-insensitive code, or vice-versa? I suspect it'll be implemented as a source-level switch rather than a pragma-type switch.

dark coder
21
Years of Service
User Offline
Joined: 6th Oct 2002
Location: Japan
Posted: 23rd Jan 2011 12:57
Quote: " You're also not marketing towards open source where there is syntactical standards, but independent developers or studios who want a more powerful pipeline.."


Open-source has absolutely nothing in the universe to do with coding standards. Nor are coding standards and having a powerful pipeline even remotely related.


As for the compiler switches, I'm against any form of option that would alter the way the code is written, otherwise code snippets wouldn't be the same. The only options there should be are ones that merely alter the binary, like the version/name/icon or are otherwise not required to just run some code.

Benjamin
21
Years of Service
User Offline
Joined: 24th Nov 2002
Location: France
Posted: 23rd Jan 2011 13:30
Quote: "@Benjamin,
But how reasonable is it to switch? How can you can a case-sensitive function from a piece of case-insensitive code, or vice-versa? I suspect it'll be implemented as a source-level switch rather than a pragma-type switch."


You're right. In that case I'm all for implicit declaration and case-sensitivity for identifiers.
Digital Awakening
AGK Developer
21
Years of Service
User Offline
Joined: 27th Aug 2002
Location: Sweden
Posted: 1st Feb 2011 20:35 Edited at: 1st Feb 2011 21:00
I do not like case sensitivity in program code at all (commands, functions, variables).

But having the IDE automatically format the code for me would be great! It would be nice if it could format the code according to my declarations. So I can decide the look of my own functions and variables.

[center]
Travis Gatlin
14
Years of Service
User Offline
Joined: 14th May 2009
Location: Oxford, Alabama
Posted: 15th Feb 2011 21:21
Please, don't include case sensitivity, i nearly pulled my hair out trying to figure out why the print command wouldnt work in python until i figured out it was case sensitive.

Your signature has been erased by a mod - Please reduce it to 600x120 maximum size
candy
13
Years of Service
User Offline
Joined: 16th Feb 2011
Location: mycosplayclub.com
Posted: 16th Feb 2011 10:09
A definite no from me!

I wanna hold you, till the fears in me subsides..
Alquerian
18
Years of Service
User Offline
Joined: 29th Mar 2006
Location: Reno Nevada
Posted: 17th Feb 2011 01:09
I vote YES for Case Sensitivity. If that means explicitly declaring them, so be it, I would like to have that option.

The only problem with case sensitive languages is when you are editing the source and the search functionality of that editor is case insensitive.

I agree with GG that case insensitivity encourages sloppy coding, promoting the lack of good programming practice. I am not suggesting that strict-enforcement of case-sensitivity is the solution, but I do think it should be encouraged and recommended.
LeeBamber
TGC Lead Developer
24
Years of Service
User Offline
Joined: 21st Jan 2000
Location: England
Posted: 15th Mar 2011 00:48
We are pretty agreed that the majority are voting case insensitivity, and the current AppGameKit compiler is designed around this. That said, we are strongly thinking about having the default IDE provide lazy auto-correction for camel case so if just typed setspriteposition quickly in lower case and look up, by default you would see the IDE adjust it to SetSpritePosition. This can be changed in the preferences, but the default IDE settings would promote readable code and hopefully encourage coders to start adding the capitals themselves.

I drink tea, and in my spare time I write software.
Fatal Berserker
13
Years of Service
User Offline
Joined: 2nd Jul 2010
Location:
Posted: 4th Apr 2011 17:27
Quote: "That said, we are strongly thinking about having the default IDE provide lazy auto-correction for camel case so if just typed setspriteposition quickly in lower case and look up, by default you would see the IDE adjust it to SetSpritePosition."

yes please

Phaelax
DBPro Master
20
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 5th Apr 2011 03:29
I like using lower camel case, it's the standard java convention which I'm used to. I tend to capitalize UDT names as I might with Object names.

The Internet: Where men are men, women are men, and children are federal agents
Ched80
13
Years of Service
User Offline
Joined: 18th Sep 2010
Location: Peterborough, UK
Posted: 6th Apr 2011 10:19
One feature I like about VBA that I'd like to see in AppGameKit is the ability to auto-capitalise recognised words such as commands and user variables.

For example if I name a variable "MyVariable" and then type "myvariable" later on in my code, its really useful to see it auto-correct to "MyVariable" as it confirms to me that I've spelt it right.

It lets me do a quick scan of the code and double-check any text that remains all lower case.

Just a thought.

[url="http://raptr.com/No_Turn_Right?src=em_forum"][/url]
Digital Awakening
AGK Developer
21
Years of Service
User Offline
Joined: 27th Aug 2002
Location: Sweden
Posted: 6th Apr 2011 18:21
I believe that is planned, at least for the commands. It shouldn't be impossible to do it with declared variables.

LeeBamber
TGC Lead Developer
24
Years of Service
User Offline
Joined: 21st Jan 2000
Location: England
Posted: 7th Apr 2011 06:07
As you say, lazy auto correction for established core commands but an user defined names will be left alone. I personally loathe the editor that thinks it knows better than me what I want. The number of times I have looked up from XCODE to find it's 'kindly' inserted lots of
brackets for me, leaving me to spend as much time again deleting them. The crazy part is that I've not spent the five minutes needed to find the tick box which switches this evil behaviour off. For AppGameKit users, I want to save them this five minutes and keep interfering IDE's at bay.

I drink tea, and in my spare time I write software.
Digital Awakening
AGK Developer
21
Years of Service
User Offline
Joined: 27th Aug 2002
Location: Sweden
Posted: 7th Apr 2011 11:37
Lee:
What I meant was that if I declare my variables (like MyVar) it would be nice if the auto correction changed myvar to MyVar. The same with functions. It should not mess with my declarations or my undeclared variables, but if I declare them in one way I clearly want them like that.

I'm not sure about my take on the auto brackets. One good thing about them is that you get your brackets in the correct places. I've written some bracket packed lines in my days, especially annoying when DBP uses () for both functions and arrays. Auto brackets means we wouldn't get "Irregular number of brackets" errors. It could be off by default

2Beastmode4u
13
Years of Service
User Offline
Joined: 14th Feb 2011
Location: Loading...
Posted: 12th May 2011 15:50
No way would I like that. I'd die.

God help me, Please.
Libervurto
17
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 15th May 2011 18:20 Edited at: 15th May 2011 18:25
Quote: "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. "

I would agree with you if variables had to be declared before use, the fact they aren't means a typo like wrong capitalization would screw up your whole program and be very hard to track down.

Isn't there a way to have optional case sensitivity? If you choose not to have case sensitivity the compiler could convert everything to lower case when compiling. Or as Lee suggested you could have an auto-correct feature for lowercase UPPERCASE or Camelcase. Did anyone use TDK's IDE? That included a variable list which was very useful for avoiding typos. Will there be something like that in the AppGameKit IDE?

How about a third option, case-sensitivity with auto-correction. The main difference being if you have a variable called MyVar you CANNOT use a variable called myvar or any other capitalization. The editor would correct all instances of a variable name to the format of the first instance.
I really can't see the need for two variables with the same name, that is surely asking for trouble!

Your memory has been erased by a mod - Your new name is Brian.
Mobiius
Valued Member
21
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 10th Jul 2011 16:45
I vote for a case insensitive compiler, and an IDE which corrects users variables based on their defined spelling, and commands based on a user setting. (lower, UPPER, lCamelCase, or UCamelCase)

This behaviour was used in VB for Visual Studio 6 (and perhaps other ones) and it worked fine. Please lets just use that.

My signature is NOT a moderator plaything! Stop changing it!

Login to post a reply

Server time is: 2024-04-16 11:58:29
Your offset time is: 2024-04-16 11:58:29