Oxygen Basic

Programming => Bugs & Feature Requests => Topic started by: Peter on February 12, 2011, 03:14:22 PM

Title: is this a bug ?
Post by: Peter on February 12, 2011, 03:14:22 PM
Deleted
Title: Re: is this a bug ?
Post by: JRS on February 12, 2011, 07:34:04 PM
Personally I see no advantage in using multiple statements on a single line. A second statement after a IF/THEN is cruel.  >:(

ScriptBasic gains a lot of it's speed as an interpreter due to the single statement per line rule. Much easier to compile into pcode.

Title: Re: is this a bug ?
Post by: Charles Pegge on February 12, 2011, 08:28:28 PM
Oxygen has very flexible parsing rules - a great challenge to implement but it gives the programmer great flexibility of expression and makes code porting easier. You can get the code working before imposing the preferred style.

Personally I use colons when the statements go together naturally as a semantic unit. But I think we can all agree that clarity is paramount.

Just to show off, These 2 extreme variations do the same thing :)

Code: [Select]
10 a=100 : b=0 : tx="" : iF a=10 then b=a : tx = "HALLO" else tx="GOODBYE" : b=a*2
20 print tx + "  " + b

Code: [Select]
long a=100;
long b;
string tx;
if (a==10) {
  b=a;
  tx = "HALLO";
} else {
  tx="GOODBYE";
  b=a*2;
};

 print tx + "  " + b;

Charles
Title: Re: is this a bug ?
Post by: Charles Pegge on February 13, 2011, 03:08:45 AM
I think Assembler is good too but enforcing one instruction per line
m
a
k
e
s

i
t

h
a
r
d

t
o

r
e
a
d


 ;D

therefore Oxygen supports:

mov eax,a : add eax,4 : mov b,eax

Charles
Title: Re: is this a bug ?
Post by: JRS on February 13, 2011, 01:13:00 PM
I was referring to Basic and interpreters specifically.