Strict vs. SuperStrict

BlitzMax Forums/BlitzMax Beginners Area/Strict vs. SuperStrict

Newbie(Posted 2007) [#1]
I use Strict to "somewhat' enforce good coding style; I see in the documentation there is a command called "SuperStrict" but the documentation has nothing, nada about it .. all it says is "set superstrict mode" ... Not exactly helpful ...


FlameDuck(Posted 2007) [#2]
Well it does. You should use it. If memory serves, the main difference is that it forces you to declare which type your variable or references is (as opposed to which scope it has).


Newbie(Posted 2007) [#3]
I do use "Strict", and tried changing to SuperStrict and still built everything fine; then again, I always declare everything anyway, so that might be why Superstrict did not flag anything. I am using SuperStrict now, and hope someone can explain the details between strict and superstrict sometime?


Gabriel(Posted 2007) [#4]
FlameDuck already explained the difference. Strict forces you to declare variables. SuperStrict forces you to declare variables and specify their type.

Try the following four examples :

Strict
A=1


Strict
Local A=1


SuperStrict
Local A=1


SuperStrict
Local A:Int=1



H&K(Posted 2007) [#5]
Not only does it force good nameing and scope practice apon you, but it also makes the compiled code better, (apparantly).

And somtimes its not obvious with only strict if you are allocating a Int handle or an object pointer


Perturbatio(Posted 2007) [#6]
Not only does it force good nameing and scope practice apon you, but it also makes the compiled code better, (apparantly).


Yes, Mark mentioned that there are optimizations that could be used because BM no longer has to do as much checking/conversion (or something like that).

Personally, I think Mark should change the Superstrict keyword to strict, Alias Superstrict to Strict (for backwards compatibility) and do away with strict mode altogether.


Newbie(Posted 2007) [#7]
God stuff guys; I have superStrict as my very first command at the top of my code.