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.

Newcomers DBPro Corner / Explicit Variable declaration..

Author
Message
AlexB
21
Years of Service
User Offline
Joined: 30th Oct 2003
Location:
Posted: 30th Oct 2003 14:25
Is there an option to enable explicit variable declaration in Dark Basic and prevent it just instantiating new variables when values are assigned to ones which don;t exist? I seem to be wasting literally hours drudging through code to find out why something's not working only to discover that it's cos I accidently mis-spelled a global variable. The only way round it is for me to run the thing every time I add new functions, subs etc.
Any ideas?
thanks a lot!
RedRain
21
Years of Service
User Offline
Joined: 11th Jun 2003
Location:
Posted: 30th Oct 2003 14:44
No unfortunately not. Gotta be the single most annoying thing about Dark Basic. Apaprently they may be implementing this in a future patch. I sure hope so! You can get round it by declaring all of your variables as arrays of 1, because arrays can't be created on the fly. It's the only way to avoid it!
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 30th Oct 2003 19:48
There is a trick you can use (I don't usually because it's too much bother).

You do this ...

CattleRustler
Retired Moderator
21
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 30th Oct 2003 20:05
ha ha, yikes! Hopefully dbp updates or new IDE will include Option Explicit

-RUST-
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 30th Oct 2003 21:24
It's unlikely to be a part of an IDE ... to do it that way, you would effectively have to have to recreate the parsing mechanism of DBPro (in effect, write half a compiler).

It's far easier for Lee to add it.
CattleRustler
Retired Moderator
21
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 31st Oct 2003 00:33
sweet - make it happen!


-RUST-
zircher
21
Years of Service
User Offline
Joined: 27th Dec 2002
Location: Oklahoma
Posted: 31st Oct 2003 02:01
Nice trick, btw. I may have to use that in future projects.
--
TAZ

Login to post a reply

Server time is: 2024-11-25 14:35:10
Your offset time is: 2024-11-25 14:35:10