Strict mode

Started by Hamish, April 27, 2020, 22:19:32

Previous topic - Next topic

Hamish

I want to start using BlitzMax NG, but I notice that strict mode is turned on by default, and I can't find a way to turn it off. Is it possible? I've got a lot of regular BlitzMax code I'd like to bring over but it's all written in non-strict.

GW

No, You'll have to define variables with NG.

Hardcoal

Strict is an important command in a serious programming.. you better get used to work like that and save for yourself a lot of bugging problems

SuperStrict, I hate.  I can do well without it. but maybe some people feel its essential too
Code

Brucey

Strict isn't so bad.
Sure, you have to start giving the compiler a bit more information (like when a type isn't an Int), but at the end of the day the compiler will help you a lot by preventing you from writing really hard to debug code that the only way to work out what's wrong with it is to debug it step by step.

Of course, SuperStrict is the way to go if you want to take your code to another level...

It's a shame BlitzMax even had a non-Strict version from the start. It just encouraged laziness, and lots of assumptions, which occasionally turned out to be wrong, and resulted in  really hard to find bugs.

Steve Elliott

#4
Quote
It's a shame BlitzMax even had a non-Strict version from the start. It just encouraged laziness, and lots of assumptions, which occasionally turned out to be wrong, and resulted in  really hard to find bugs.

Absolutely, I think Mark wanted to ease the transition from Blitz BASIC to BlitzMax.  But I agree it was a huge mistake.
Win11 64Gb 12th Gen Intel i9 12900K 3.2Ghz Nvidia RTX 3070Ti 8Gb
Win11 16Gb 12th Gen Intel i5 12450H 2Ghz Nvidia RTX 2050 8Gb
Win11  Pro 8Gb Celeron Intel UHD Graphics 600
Win10/Linux Mint 16Gb 4th Gen Intel i5 4570 3.2GHz, Nvidia GeForce GTX 1050 2Gb
macOS 32Gb Apple M2Max
pi5 8Gb
Spectrum Next 2Mb

Hardcoal

I think you can get along rather well without superstrict..
Code

Steve Elliott

#6
Quote
I think you can get along rather well without superstrict..

I think the idea of a language with a non-strict, strict and superstrict options ridiculous.  Design the language properly and stick to your guns, rather than this non-standard free-for-all nonsense...You'll never please all of the people all of the time, so don't try.  Produce something you believe in, rather than apologize for any strictness.  So in coding terms, don't give someone enough rope to hang themselves! 
Win11 64Gb 12th Gen Intel i9 12900K 3.2Ghz Nvidia RTX 3070Ti 8Gb
Win11 16Gb 12th Gen Intel i5 12450H 2Ghz Nvidia RTX 2050 8Gb
Win11  Pro 8Gb Celeron Intel UHD Graphics 600
Win10/Linux Mint 16Gb 4th Gen Intel i5 4570 3.2GHz, Nvidia GeForce GTX 1050 2Gb
macOS 32Gb Apple M2Max
pi5 8Gb
Spectrum Next 2Mb

hackball

Quote from: Steve Elliott on April 28, 2020, 21:11:59
Quote
I think you can get along rather well without superstrict..

I think the idea of a language with a non-strict, strict and superstrict options ridiculous.  Design the language properly and stick to your guns, rather than this non-standard free-for-all nonsense...You'll never please all of the people all of the time, so don't try.  Produce something you believe in, rather than apologize for any strictness.  So in coding terms, don't give someone enough rope to hang themselves!
Creating a language offering a layered level of control is quite nice: but also weird. Once the language's parser/compiler knows what you are about to do it doesn't need to pretend to offer any other (more stupid) option. Just like a grammar check or so.I don't dig SuperStrict for that reason. It is so smart - just fix my mistakes, okay?
I don't like Strict either, because one can no longer add simple Labels to jump to. I really miss that feature from the old BlitzBasic.

Derron

You can still jump - just you do no longer use labels (btw they should work within for loops to "exit" to a specific loop).

Non-strict in "legacy BlitzMax" was too tolerant for stuff returning Byte Pointers being stored in Integers automatically. And other stuff for sure too. When it comes to cross-platform and 32 + 64 bit support you cannot be too tolerating.

I write all my code in "superstrict" mode as it avoids a lot of trouble for the often happening cases of "debugging sessions" :)


bye
Ron

Hardcoal

I cant blame him for not wanting strict.. but i really dont see whats the big deal...
anyway i hope his dreams will come true, because i know how it feels when you are forced to do something you dont like, and got used to doing without  ;)
Code

Brucey

Well, there's always the original legacy version of BlitzMax, which still works the same on Windows. That still continues to have a non-Strict mode.

Hamish

I've written hundreds of thousands of lines of BlitzMax and never had trouble debugging non-strict code, all it means for me is I have to go and write Local in front of all my variable declarations
It's a dealbreaker for me, I can't just nicely port over my codebase, it'd be nice if it was at least a compiler option

Hardcoal

I can understand your frustration.. thats all i can say
Code

Derron

Non-strict is not an option in NG ... and surely won't be. It is hard to "make assumptions" when converting bmx code to C before it can get passed to the final compiler then.

Non-strict does not differentiate between "int", "nothing/void", "byte ptr" etc. Also the issue with "local scope" variables is not so clear then. When working with 3rd party code and no proper intellisense editor you might misspell a variable without recognizing it. As long as the original var is "0" there is no issue.


Also "strict" ensures you do not do silly mistakes (assuming that a function returns something which it doesn't). 100k code lines in non-strict ... chances are high you have flaws in it (even if they are not "visible" now). Chances for perfect working code exist (>0.00) as others did code that way earlier too but for myself, SuperStrict is my preferred way to code.


bye
Ron

Hardcoal

I agree with you Derron, and ill never use code without Strict..
But this guy is frustrated that he doesnt have the ability to choose for himself, and forced to use it.
anyway, if i was him, i would just get used to doing it with strict..
you can also build a simple Code translator that automatically changes your text code, adding definitions to everything
Code