May 31, 2020, 09:09:07 PM

Author Topic: Strict mode  (Read 372 times)

Offline Hamish

  • Jr. Member
  • **
  • Posts: 3
Strict mode
« on: April 27, 2020, 10:19:32 PM »
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.

Offline GW

  • Full Member
  • ***
  • Posts: 199
Re: Strict mode
« Reply #1 on: April 28, 2020, 03:17:42 AM »
No, You'll have to define variables with NG.

Offline Hardcoal

  • Sr. Member
  • ****
  • Posts: 454
Re: Strict mode
« Reply #2 on: April 28, 2020, 04:07:04 AM »
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
Happy New Year

Offline Brucey

  • Full Member
  • ***
  • Posts: 127
Re: Strict mode
« Reply #3 on: April 28, 2020, 04:44:35 PM »
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.

Online Steve Elliott

  • Hero Member
  • *****
  • Posts: 2454
Re: Strict mode
« Reply #4 on: April 28, 2020, 05:01:25 PM »
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.
Windows 10, 64-bit, 16Gb RAM, CPU Intel i5, 3.2 GHz, Nvidia GeForce GTX 1050 (2Gb).
MacOS Catalina, 64-bit, 8Gb RAM, CPU Intel i5, 2.3 Ghz, Intel Iris Plus Graphics 640 1536 MB.
Linux Mint 19.3, 64-bit, 16Gb RAM, CPU Intel i5, 3.2 GHz, Nvidia GeForce GTX 1050 (2Gb).
Raspberry pi 3 and 4.

Offline Hardcoal

  • Sr. Member
  • ****
  • Posts: 454
Re: Strict mode
« Reply #5 on: April 28, 2020, 05:15:14 PM »
I think you can get along rather well without superstrict..
Happy New Year

Online Steve Elliott

  • Hero Member
  • *****
  • Posts: 2454
Re: Strict mode
« Reply #6 on: April 28, 2020, 09:11:59 PM »
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! 
Windows 10, 64-bit, 16Gb RAM, CPU Intel i5, 3.2 GHz, Nvidia GeForce GTX 1050 (2Gb).
MacOS Catalina, 64-bit, 8Gb RAM, CPU Intel i5, 2.3 Ghz, Intel Iris Plus Graphics 640 1536 MB.
Linux Mint 19.3, 64-bit, 16Gb RAM, CPU Intel i5, 3.2 GHz, Nvidia GeForce GTX 1050 (2Gb).
Raspberry pi 3 and 4.

Offline hackball

  • Jr. Member
  • **
  • Posts: 26
Re: Strict mode
« Reply #7 on: April 29, 2020, 01:22:20 AM »
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.

Offline Derron

  • Hero Member
  • *****
  • Posts: 2975
Re: Strict mode
« Reply #8 on: April 29, 2020, 06:52:33 AM »
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

Offline Hardcoal

  • Sr. Member
  • ****
  • Posts: 454
Re: Strict mode
« Reply #9 on: April 29, 2020, 08:04:19 AM »
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  ;)
Happy New Year

Offline Brucey

  • Full Member
  • ***
  • Posts: 127
Re: Strict mode
« Reply #10 on: April 29, 2020, 08:09:51 AM »
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.

Offline Hamish

  • Jr. Member
  • **
  • Posts: 3
Re: Strict mode
« Reply #11 on: May 29, 2020, 02:46:20 AM »
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

Offline Hardcoal

  • Sr. Member
  • ****
  • Posts: 454
Re: Strict mode
« Reply #12 on: May 29, 2020, 02:51:24 AM »
I can understand your frustration.. thats all i can say
Happy New Year

Offline Derron

  • Hero Member
  • *****
  • Posts: 2975
Re: Strict mode
« Reply #13 on: May 29, 2020, 08:47:44 AM »
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

Offline Hardcoal

  • Sr. Member
  • ****
  • Posts: 454
Re: Strict mode
« Reply #14 on: May 29, 2020, 09:08:17 AM »
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
Happy New Year

 

SimplePortal 2.3.6 © 2008-2014, SimplePortal