Page 1 of 2

Bug 4.31 variables ?

Posted: Thu Jun 18, 2009 12:09 pm
by glops
Hi,
I believed a global CARD$ was different than a local card$ in a procedure ? Did I ever missed they were the same ? I'm surprised, pretty sure was different, as one is in uppercase, over in lowercase....

Posted: Thu Jun 18, 2009 12:16 pm
by eesau
PureBasic is not case-sensitive, so CARD$, card$ and cArD$ are all same.

Posted: Thu Jun 18, 2009 12:17 pm
by Fred
PB is case insensitive.

Posted: Thu Jun 18, 2009 12:18 pm
by Kaeru Gaman
the Case does not distinguish Names in PureBasic, it never did!

both names are the same, you could even write Card$

if you want a different Var than the Global in a Proc, use

Code: Select all

Protected Card$
if you need both Variables, use different names for them, e.g. G_Card$ and L_Card$ (Global and Local)

Posted: Thu Jun 18, 2009 1:30 pm
by Psychophanta

Posted: Thu Jun 18, 2009 2:07 pm
by Fred
Kaeru Gaman wrote:the Case does not distinguish Names in PureBasic, it never did!
To be honnest, it did, but a very very long time ago ;)

Code: Select all

27 January 2002 : Version 2.90
- Changed: Variables, Arrays, LinkedList and Constants are now case insensitive.

Posted: Thu Jun 18, 2009 5:10 pm
by gnasen
Fred wrote:
Kaeru Gaman wrote:the Case does not distinguish Names in PureBasic, it never did!
To be honnest, it did, but a very very long time ago ;)

Code: Select all

27 January 2002 : Version 2.90
- Changed: Variables, Arrays, LinkedList and Constants are now case insensitive.
Im really (really really) cheerfull that you did this step.
There is nearly nothing, which is more annoying me then case-sensitive-bugs. In my opinion it increaes, combined with a good editor, the readability of code (auto correction).

Posted: Thu Jun 18, 2009 5:36 pm
by Mistrel
gnasen wrote:Im really (really really) cheerfull that you did this step.
There is nearly nothing, which is more annoying me then case-sensitive-bugs. In my opinion it increaes, combined with a good editor, the readability of code (auto correction).
Combined with EnableExplicit I don't think case sensitivity would be a problem.

Posted: Thu Jun 18, 2009 5:43 pm
by Perkin
What orig poster may have been confused about reading previously, is that 'CARD$' is different variable than 'CARD.s'

Posted: Thu Jun 18, 2009 9:57 pm
by Psychophanta
gnasen wrote:In my opinion it increaes, combined with a good editor, the readability of code
iN mY opIniOn It deCreaSeS A loT thE ReaDaBiLiTY!
'D' is a symbol and i don't see there anything to do with the symbol 'd'.

Your brains are very well educated to do a work:
convert 'D' to 'd' or viceversa
Work which is a nonsense, of course, because it could be easely saved.

Posted: Thu Jun 18, 2009 10:06 pm
by Trond
'D' is a symbol and i don't see there anything to do with the symbol 'd'.
And and and doesn't mean the same, right? They never did, right? Oh wait, I think they do!

At first they had only uppercase letters. They made the others for readability. The readability increases when upper- and lowercase letters are mixed in the correct way. If they are mixed in an incorrect way decreased readability occurs.

Posted: Thu Jun 18, 2009 10:25 pm
by Psychophanta
Trond wrote:...If they are mixed in an incorrect way decreased readability occurs.
PB editor allows to do "decreased" readability, because it allows things like this:

Code: Select all

varia.f+rition.f
;code...
;code...
;code...
vARiA.F-rItiON
or

Code: Select all

Co_mols=3E23
CO_mols=1.2E32
But Co is cobalt
while CO is carbon monoxide :shock:

Posted: Thu Jun 18, 2009 10:28 pm
by Fred
IMHO, it's better than having several identifiers which holds differents values with the 'same' name.

Code: Select all

sum = 10
Sum = 20
SuM = 30
SUM = 40

Debug Sum

Posted: Thu Jun 18, 2009 10:45 pm
by rsts
This will probably turn into another war of the cases.

I'm with Fred.

And it's probably time to lock this one too :)

cheers

Posted: Thu Jun 18, 2009 11:23 pm
by idle
you only have to suffer from dyslexia to know that languages like C are a pain in the butt when it comes to finding a bug due to a case sensitive variable that's not the same as it was declared.

So I'm really glad PB is case insensitive, lets me get on with coding as opposed to trying to find silly bugs.

fi uoy nac dear shit tithouw ghinkint uoy era yrobablp cyslexid