I am still amazed at things that are not present anywhere in the main documentation pages but should be such as bitwise, or logical, operators.
Only a very few would know about these built-in Core operators, perhaps an intrepid spelunker who enjoys exploring the Core-Changes Cavern or perhaps someone who once asked a Core developer if POL has bitwise operators and then of course the Core developers themselves. There might even be one or two Core devs who do not know of these hidden gems.
Well, here's the scoop on the four operators:
int & int Performs a logical and on the two integers.
int | int Performs a logical or on the two integers.
int ^ int Performs an exclusive-or (XOR) on the two integers.
~ int Performs a 32 bit "one's compliment" on the integer.
These need to be added to Racalac's eScript Guide in the Arithmetic section.
Missing operator documentation.
Re: Missing operator documentation.
I already tested it all.
https://en.wikipedia.org/wiki/Mask_(computing)
It really is a jewel!
the pol compiler supports an integer of 31 flags
0x7FFFFFFF ==(bin)1111111111111111111111111111111
and for those who do not understand what that means, an integer can send 31 messages, on or off, through a single integer.
these operators can turn the flags on and off, check if the flags are raised (enabled).
https://en.wikipedia.org/wiki/Mask_(computing)
It really is a jewel!
the pol compiler supports an integer of 31 flags
0x7FFFFFFF ==(bin)1111111111111111111111111111111
and for those who do not understand what that means, an integer can send 31 messages, on or off, through a single integer.
these operators can turn the flags on and off, check if the flags are raised (enabled).
Re: Missing operator documentation.
i'd rather to have this new stuff in eScript
Code: Select all
if (true)
then();
//endif // c like
else
i++; // more familiar than i:=i+1
//endif
Re: Missing operator documentation.
Well to hijack my own thread I will ask for specifics on your feature request atreiu.
Is it the "if", "then" construct you want or the"i++" construct or both.
There is already" i+=<some number>", i-=<some number>", etc.
I remember the if, then construct from my BASIC programming days back in high school. That was in the 1970s. I rather prefer the eScript syntax because it saves typing the "then". It is one less word I am likely to misspell
Is it the "if", "then" construct you want or the"i++" construct or both.
There is already" i+=<some number>", i-=<some number>", etc.
I remember the if, then construct from my BASIC programming days back in high school. That was in the 1970s. I rather prefer the eScript syntax because it saves typing the "then". It is one less word I am likely to misspell
Re: Missing operator documentation.
I think he's potentially suggesting both.
Would be 1 less character than
And i think
Just eliminates the requirements.
Code: Select all
i++;
Code: Select all
i+=1;
And i think
Code: Select all
if (this)
then(that)
Code: Select all
endif
Re: Missing operator documentation.
Ok. I don't think in light of the i+=, i-= etc. we are fine and I prefer the if...else...endif construct.