SuperStrict Not Strict Enough

BlitzMax Forums/BlitzMax Programming/SuperStrict Not Strict Enough

H&K(Posted 2006) [#1]
I know that floats are often converted automaticaly to Int when needed. But can we have a SuperSuperStrict that at least warns you when this is happening.
Or turns it Off so that implicite converstion is needed.


Chris C(Posted 2006) [#2]
theres such a stink last time capitlisation (bad idea!) and so many potential things that super strict could do wouldnt this be better

superstring bitmask

where bitmask could be floats,caps,function pointer returns etc

this would save us from needing a SuperVerySuperStrict command!


skidracer(Posted 2006) [#3]
Please don't post requests in bug reports.


H&K(Posted 2006) [#4]
I think its a bug.
I think its an error for the Compiler not to warn me when I've accidently send a float to an int.

@Chris. I could live with your idea, Id probably turn them all on. (And yes I think the compiler should give an error if you dont indent for/next loops ;)

And all the Colour commands should be spelt properly.

On a serious note, Is there an Alias command that works on field Names?
i.e.
Type CoOrd
Field x:Int Alias Width
Field y:Int Alias Height


Grey Alien(Posted 2006) [#5]
I vote for a bitmask!


Warren(Posted 2006) [#6]
A bitmask?! This thread hurts my brain.


Chris C(Posted 2006) [#7]
@WarrenM
http://en.wikipedia.org/wiki/Bitmask

basically each value would have its own binary value (1,2,4,8...) so that individual flags can be set/checked for without effecting each other


H&K(Posted 2006) [#8]
@Warren
Any command the has | in its parameters, is using a bitmask

So (for example) 00000001 is called Flag_one
and 00000010 Is called Flag_Two

So Flag_One | Flag_Two (Flag_One and Flag_Two) = 00000011


Dreamora(Posted 2006) [#9]
Why not just say: Like collision masks? :-)


H&K(Posted 2006) [#10]
Well I for one havent ever used collision masks, so thats why I didnt say: Like collision masks :-), Cos I didnt know they were.


Grey Alien(Posted 2006) [#11]
Bitmasks are pretty retro but still useful.


H&K(Posted 2006) [#12]
I agree, they were a bit usful when you realy needed to save those Bytes.
I for one often allocate a Flag to a Long, and be dambed those 63bits I'm wasting ;)


Amon(Posted 2006) [#13]
Why do you think Mark hasn't added a SuperVeryStrict?

Also, does not using any form of strict meake for bad coding?


FlameDuck(Posted 2006) [#14]
Also, does not using any form of strict meake for bad coding?
Not nessecarilly, but it does seriously reduce the ammount of optimization the compiler can do.

I still wish identifiers where case sensitive.


Chris C(Posted 2006) [#15]
but it does seriously reduce the ammount of optimization the compiler can do.

can you give some examples of why you think this is the case?

Caps are more about esthetic reasons than actually stopping inadvertent bugs


Regular K(Posted 2006) [#16]
Why dont we just have a function that you add flags to it for strictiness?

1 = bitmasks
2 = force explicit conversions
...

then everyone will be satified?


FlameDuck(Posted 2006) [#17]
can you give some examples of why you think this is the case?
One example would be variable scope. In any of the Strict modes, all variables are explicitly scoped. This allows the compiler to make many optimizations with regards to register allocation, as a 'temporary' variable (for instance one that is used to hold the return value (in a pass by value scenario), or for simplifying complex expressions) does not need to have memory allocated for it at all.

Caps are more about esthetic reasons than actually stopping inadvertent bugs
In my experience, Caps are about readability - forcing people to use caps (and indention - like Python does) in such a way as to make code more readable does - IMHO prevent inadvertent bugs. Or at least, it makes it easier to track them down, and in a language which allows inconsistent naming conventions (like Blitz) it's really hard to enforce coherent coding standards.


N(Posted 2006) [#18]
can you give some examples of why you think this is the case?


One example: when Strict is off, it's similar to defining all local variables at the very start of a function. You lose the benefit of variables having scope beyond the root of a function.


H&K(Posted 2006) [#19]
@In any of the Strict modes, all variables are explicitly scoped

Well arent they all in non strict mode anyway?
Surly non strict mode doent turn off scope? Local variable still have local scope

I must admit that i didnt know that Strict made the compiled code better. I always thought it was optimizing the compilation time, not the compilation itself.


FlameDuck(Posted 2006) [#20]
Surly non strict mode doent turn off scope? Local variable still have local scope
Local to what? Try this:
'Strict

If True
	Local myNinja:Int = 100
EndIf
Print myNinja
Works fine, right? Try it in Strict mode. Doesn't work, because myNinja is out of scope.


Brucey(Posted 2006) [#21]
Does anyone have any good reasons for not using a Strict mode? (other than perhaps being really really lazy)

I remember using Blitz Basic II on the Amiga (yes, yes, a long time ago now), and I had introduced a bug into my code that took me ages to find... I had typed a lower-case "L" somewhere instead of an "i", and they kind of looked the same... with Strict on this would be caught at compile time (assuming I hadn't already used "L" somewhere)


And as far as I can see, most languages allow for inconsistent naming conventions. (although java says variables should start lower-case, it doesn't stop you).
And having Caps functionality wouldn't stop that...

Each to their own, I say.
I'm sticking to my SuperStrict mode all the way....

:o)


FlameDuck(Posted 2006) [#22]
And as far as I can see, most languages allow for inconsistent naming conventions. (although java says variables should start lower-case, it doesn't stop you).
Well I don't really agree with that either. But some IDEs (like say Eclipse IIRC) will tell you when/if you've done something different than what you've told it to do in the code formating options.

Each to their own, I say.
Well sure. But it would still be nice to have the tools to enforce 'ones own way', so that multiple people working on the same project commit (more) uniform code. It's unfortunately little things like this that make BlitzMAX more suitable for "lone gunman" projects, and less applicable to collaborative ones.


Grey Alien(Posted 2006) [#23]
I used to really hate the fact that BlitzPlus let you accidently type in an incorrect variable name and it would init it with 0. This caused me countless hours of bug hunting. I used strict for the mainly.

What does superstrict do extra?


Warren(Posted 2006) [#24]
FFS, I understand what a bitmask is. I just can't believe that you want to use one for strict parameters. Unbelievable. Learn to code.


Grey Alien(Posted 2006) [#25]
strict is useful to catch dumb mistakes and to save time.


Warren(Posted 2006) [#26]
Did you get the impression that I was somehow against strict? As far as I'm concerned, this language should compile like C++ does - write the code properly or it's not going to compile. Period.


ImaginaryHuman(Posted 2006) [#27]
I am happy using just the original Strict, I guess it all depends on how you like to code things.


H&K(Posted 2006) [#28]
One of the things I think the IDE could do is have strict-build and a nonstrict-build buttons. (F5 Strict Build)(F6 NonStrict) for example. This would allow me at build time to choose quicker, and would avoid the problem of stricts in include files. (The strict build button could be a space shuttle, and the non strict build button Ariane)

@Warren The Language does compile like c++ does, in c++ you choose at what level of "error" the compiler throws a wobbly. As we do with Strict and SuperStrict, we are just decussing if we would like another level.

And yes you did give the impression that you didnt know what bitmasks were


N(Posted 2006) [#29]
Well, for the record, I disagree with adding another type of Strict or (inclusive) another implementation of it.


Warren(Posted 2006) [#30]
Multiple levels is pointless, in the same way that coding in C++ at anything other than the highest level is pointless. Learn to code.


N(Posted 2006) [#31]
I find myself agreeing with WarrenM.