[Implemented] Define multiple Dim and NewList in a row.

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
User avatar
Flype
Addict
Addict
Posts: 1542
Joined: Tue Jul 22, 2003 5:02 pm
Location: In a long distant galaxy

[Implemented] Define multiple Dim and NewList in a row.

Post by Flype »

Just a small request - for consistency.

it is possible to define multiples variables in one line.

so it might be possible to define Dim and NewList in the same way, isn't it ?

Code: Select all

Define Var1.l, Var2.f, Var3.s ; possible

NewList List1.l(), List2.f(), List3.s() ; not possible

Dim Array1.l(1), Array2.f(1), Array3.f(1) ; not possible

No programming language is perfect. There is not even a single best language.
There are only languages well suited or perhaps poorly suited for particular purposes. Herbert Mayer
User avatar
Psychophanta
Always Here
Always Here
Posts: 5153
Joined: Wed Jun 11, 2003 9:33 pm
Location: Anare
Contact:

Post by Psychophanta »

Very logical.
I strongly second that!
http://www.zeitgeistmovie.com

while (world==business) world+=mafia;
Num3
PureBasic Expert
PureBasic Expert
Posts: 2812
Joined: Fri Apr 25, 2003 4:51 pm
Location: Portugal, Lisbon
Contact:

Post by Num3 »

Ditto :lol:
User avatar
Psychophanta
Always Here
Always Here
Posts: 5153
Joined: Wed Jun 11, 2003 9:33 pm
Location: Anare
Contact:

Post by Psychophanta »

However, it would be confussion when adding Global, Shared, Static or Protected words before NewList or Dim words.

BTW, why doesn't work:

Code: Select all

Global Define a.l
:?:
http://www.zeitgeistmovie.com

while (world==business) world+=mafia;
freak
PureBasic Team
PureBasic Team
Posts: 5940
Joined: Fri Apr 25, 2003 5:21 pm
Location: Germany

Post by freak »

Psychophanta wrote:BTW, why doesn't work:

Code: Select all

Global Define a.l
:?:
because it makes no sense ;)
"Global" implies a definition of the variable, adding another "Define" is overkill.

Actially, this one allready works:

Code: Select all

Global a, Dim b(5), NewList c.l()
It would make sense to allow the same syntax for Define as well.
quidquid Latine dictum sit altum videtur
jear
User
User
Posts: 20
Joined: Sun Dec 28, 2003 12:27 am
Location: Ammerland

Post by jear »

BTW...

Code: Select all

Define.s a, b, c
but

Code: Select all

Global.s x, y, z
causes a syntax error!
User avatar
Flype
Addict
Addict
Posts: 1542
Joined: Tue Jul 22, 2003 5:02 pm
Location: In a long distant galaxy

Post by Flype »

freak wrote:Actially, this one allready works:

Code: Select all

Global a, Dim b(5), NewList c.l()
It would make sense to allow the same syntax for Define as well.
Ha yes, good. Thank you for the tip freak.



So at the moment we have :

Global, Protected, Static -> allow multiples.
Define, Shared -> do not allow multiples.
No programming language is perfect. There is not even a single best language.
There are only languages well suited or perhaps poorly suited for particular purposes. Herbert Mayer
User avatar
Flype
Addict
Addict
Posts: 1542
Joined: Tue Jul 22, 2003 5:02 pm
Location: In a long distant galaxy

Post by Flype »

jear wrote:BTW...

Code: Select all

Define.s a, b, c
but

Code: Select all

Global.s x, y, z
causes a syntax error!
i think it is normal !

because 'Define.s' can be used alone to 'preset' all futured variables as .s

Code: Select all

Define.s

a = "a" ; this is a string.
b = "b" ; this is a string.
but 'Global' can't be used this way (and Protected, Shared, Static).
No programming language is perfect. There is not even a single best language.
There are only languages well suited or perhaps poorly suited for particular purposes. Herbert Mayer
Chrono Syndrome
Enthusiast
Enthusiast
Posts: 169
Joined: Thu Oct 05, 2006 6:44 am
Contact:

Post by Chrono Syndrome »

Great idea !
Don't try to catch ze Night !
Remember: 'z' is better zen 'th' =) !
Sorry for bad english.
Derek
Addict
Addict
Posts: 2354
Joined: Wed Apr 07, 2004 12:51 am
Location: England

Post by Derek »

Makes sense to have more than one DIM on a line.
jear
User
User
Posts: 20
Joined: Sun Dec 28, 2003 12:27 am
Location: Ammerland

Post by jear »

because 'Define.s' can be used alone to 'preset' all futured variables as .s

Code: Select all

EnableExplicit
Define.s 

a = "a" ; this is a string. 
b = "b" ; this is a string. 
???
Post Reply