[Implemented] Variable Declaration

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

[Implemented] Variable Declaration

Post by BackupUser »

Restored from previous forum. Originally posted by Zoltan.

I hope I don't start a heated debate here, but would like to see an option whereby one has to declare variables before use. I stress that it should be an option as many "Basic" purists regard varable declaration on the fly as sacred. Since I'm such a lousy typist, I invariably mis-spell one somewhere and it takes eons to track down the problem. This feature also stops C programmers from taking swipes at a very powerful language.

(Implemented 'EnableExplicit')
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Fangbeast.
whereby one has to declare variables before use. I stress that it should be an
Hi Zoli, most of us are used to that feature so we invariably declare them anyway (or at least 'type' them) (binary, long, string, i.e MyWord.s). Especially during complex form design, where we invariably have hundreds of variables to choose from (shudder). I'm always 'defining' variables at the start of my programs (lots of them) so that it's easier to translate to other languages later on. I find this is just as easy as an explicit declaration.

Regards, Miki (Fang)

Fangles
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by El_Choni.

Hi,

Personally, I wouldn't like that 'feature' added to PureBasic. The obligation to declare variables and the unhuman way to handle variable types is one of the things that upsets me about C, and which made me move to PureBasic as soon as I tried it.

But, of course, this is only my opinion. In fact, you declare variables in PureBasic, even if you do it when you first use them.

Bye,

El_Choni
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Zoltan.

Thanx for the comments.
You folks must be much better typists than i am.
In a large program in QB I would either mis-spell or forget one or more variables. ie Use X_Trak when I had previously declared X_Trk due to forgetting the term. VB gives the option of explicit variable dec and it stops me from making silly mistakes like that. (Apart from the silly mistake of using VB in the first place).
Delphi and C don't give you the option and I can understand why some people resent that. I have actually learnt to like it. What I would like to see is the option to turn Explicit On. This gives Fangs a safety net for the hundreds of variables he declares anyway (good practice IMHO), whereas El-Choni can turn it off and enjoy the freedom that PB can provide.
The thing is, that PB offers brilliant features for advanced programming that normally has only been the domain of ASM or C programmers. To me, the lack of the option of the safety net is the only glaring ommision. (Except maybe the proper float question)
Any thoughts ?

merry Xmas to you all !!

Basic forever
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Fangbeast.
the option of the safety net is the only glaring ommision. (Except maybe the
Safety net?/ What's that (aaaaghghghg, SPLAT), damn, I didn't see that code tree :)

Fangles
Post Reply