Oxygen Basic

Information => Development => Topic started by: Peter on July 12, 2013, 06:50:13 AM

Title: Strict
Post by: Peter on July 12, 2013, 06:50:13 AM
Deleted
Title: Re: Strict
Post by: Charles Pegge on July 12, 2013, 09:31:39 AM
Developer Peter,

#autodim off is what you are looking for. However this does not work with iterators yet. I will fix this on the next release.

Another useful switch is #unique on/off, which prevents anything from being defined more than once.

These switches can be turned on or off at any position of the program.

Any further ideas for code discipline?  ;D

(http://www.theswarmite.com/wp-content/uploads/Images/dominatrix.jpg)
Title: Re: Strict
Post by: JRS on July 12, 2013, 10:42:33 AM
Quote
This program automatically creates 2 local variables: 'k' and 'sum'. However, this behaviour can often lead to unexpected bugs. For example, if you mistyped one of the 'sum' variables, the program would not work as expected. No error would be given - a new variable would simply be created.

FYI

ScriptBasic supports something similar.

declare option DeclareVars
declare option AutoVars

You can also control if variables used in functions/subs default to local scope. By default variables created within functions are global unless they are predefined as LOCAL prior to assignment within the function.

I personally like ScriptBasic's lazy / careful programming mode as the default. If I was doing a large project in SB, I would enable these language checks during the development cycle.
Title: Re: Strict
Post by: JRS on July 12, 2013, 01:33:45 PM
Quote
This image, is it a Microsoft logo?

No. I think it's Charles's vision of the golden arch for the new McDonald's campaign.  :D

Would you beg and take a few lashes for a Big Mac (http://modernmeadow.com/)?

Title: Re: Strict
Post by: kryton9 on July 13, 2013, 05:30:49 PM
I love the humor!