[Implemented] dynamic variable creation toogle

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
Zaphod
User
User
Posts: 13
Joined: Thu Feb 19, 2004 1:25 pm

[Implemented] dynamic variable creation toogle

Post by Zaphod »

i can't remember how often this created difficult locatable bugs. a mistyped variablename. i would much more prefer the compiler was shouting at me for beeing such a schmock to use an undecleared variable than to create a new one by accident.

(Implemented as 'EnableExplicit')
Froggerprogger
Enthusiast
Enthusiast
Posts: 423
Joined: Fri Apr 25, 2003 5:22 pm
Contact:

Post by Froggerprogger »

Yes, that would be fine.

But I could think of an alternative to implement it inside the compiler:
A switch inside the editor (jaPBE or the official one), which (de)activates this functionality. Realized e.g. just by displaying undeclared variables in another color, e.g. red
%1>>1+1*1/1-1!1|1&1<<$1=1
Kale
PureBasic Expert
PureBasic Expert
Posts: 3000
Joined: Fri Apr 25, 2003 6:03 pm
Location: Lincoln, UK
Contact:

Post by Kale »

--Kale

Image
Dare2
Moderator
Moderator
Posts: 3321
Joined: Sat Dec 27, 2003 3:55 am
Location: Great Southern Land

Post by Dare2 »

Actually Froggerprogger's suggestion is a good one!

In fact, so good I feel like typing it again:

Very Stern TypeCasting is on by default. (Yes!)
It can be turned off within the code.
And if turned off, un-typecast vars are highlighted in the editor.

Neat. Exit many WTF? errors - unless feeling masochistic and specifically asking for it. :)

* WTF = Why's This Failing? *
Froggerprogger
Enthusiast
Enthusiast
Posts: 423
Joined: Fri Apr 25, 2003 5:22 pm
Contact:

Post by Froggerprogger »

Yes, it could be switched by:

Code: Select all

;TypeCastOn
.
.
;TypeCastOff
.
.
;TypeCastOn
So there would be no conflict.

could & would ... :wink:
%1>>1+1*1/1-1!1|1&1<<$1=1
Post Reply