Bug 4.31 variables ?

Just starting out? Need help? Post your questions and find answers here.
glops
User
User
Posts: 38
Joined: Wed Jan 16, 2008 12:53 pm
Location: France

Bug 4.31 variables ?

Post 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....
eesau
Enthusiast
Enthusiast
Posts: 589
Joined: Fri Apr 27, 2007 12:38 pm
Location: Finland

Post by eesau »

PureBasic is not case-sensitive, so CARD$, card$ and cArD$ are all same.
Fred
Administrator
Administrator
Posts: 18162
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Post by Fred »

PB is case insensitive.
User avatar
Kaeru Gaman
Addict
Addict
Posts: 4826
Joined: Sun Mar 19, 2006 1:57 pm
Location: Germany

Post 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)
oh... and have a nice day.
User avatar
Psychophanta
Always Here
Always Here
Posts: 5153
Joined: Wed Jun 11, 2003 9:33 pm
Location: Anare
Contact:

Post by Psychophanta »

http://www.zeitgeistmovie.com

while (world==business) world+=mafia;
Fred
Administrator
Administrator
Posts: 18162
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Post 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.
gnasen
Enthusiast
Enthusiast
Posts: 282
Joined: Wed Sep 24, 2008 12:21 am

Post 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).
pb 5.11
Mistrel
Addict
Addict
Posts: 3415
Joined: Sat Jun 30, 2007 8:04 pm

Post 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.
Perkin
Enthusiast
Enthusiast
Posts: 504
Joined: Thu Jul 03, 2008 10:13 pm
Location: Kent, UK

Post by Perkin »

What orig poster may have been confused about reading previously, is that 'CARD$' is different variable than 'CARD.s'
%101010 = $2A = 42
User avatar
Psychophanta
Always Here
Always Here
Posts: 5153
Joined: Wed Jun 11, 2003 9:33 pm
Location: Anare
Contact:

Post 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.
http://www.zeitgeistmovie.com

while (world==business) world+=mafia;
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Post 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.
User avatar
Psychophanta
Always Here
Always Here
Posts: 5153
Joined: Wed Jun 11, 2003 9:33 pm
Location: Anare
Contact:

Post 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:
http://www.zeitgeistmovie.com

while (world==business) world+=mafia;
Fred
Administrator
Administrator
Posts: 18162
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Post 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
rsts
Addict
Addict
Posts: 2736
Joined: Wed Aug 24, 2005 8:39 am
Location: Southwest OH - USA

Post 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
User avatar
idle
Always Here
Always Here
Posts: 5836
Joined: Fri Sep 21, 2007 5:52 am
Location: New Zealand

Post 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
Post Reply