Missing operator documentation.

Bug reports and feature requests. New features can only be added to the current development version. Bug-fixes may be back-ported.

Current release: 099 / Current development: 100
Post Reply
Yukiko
Distro Developer
Posts: 2825
Joined: Thu Feb 02, 2006 1:41 pm
Location: San Antonio, Texas
Contact:

Missing operator documentation.

Post by Yukiko »

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.
guialtran
Grandmaster Poster
Posts: 120
Joined: Wed Jul 30, 2008 12:42 pm

Re: Missing operator documentation.

Post by guialtran »

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).
User avatar
atreiu
Grandmaster Poster
Posts: 151
Joined: Mon May 24, 2010 1:08 pm
Location: Russia, Moscow

Re: Missing operator documentation.

Post by atreiu »

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
Yukiko
Distro Developer
Posts: 2825
Joined: Thu Feb 02, 2006 1:41 pm
Location: San Antonio, Texas
Contact:

Re: Missing operator documentation.

Post by Yukiko »

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 :)
DevGIB
Grandmaster Poster
Posts: 248
Joined: Mon Feb 06, 2006 6:12 am

Re: Missing operator documentation.

Post by DevGIB »

I think he's potentially suggesting both.

Code: Select all

i++;
Would be 1 less character than

Code: Select all

i+=1;


And i think

Code: Select all

if (this)
then(that)
Just eliminates the

Code: Select all

endif
requirements.
Yukiko
Distro Developer
Posts: 2825
Joined: Thu Feb 02, 2006 1:41 pm
Location: San Antonio, Texas
Contact:

Re: Missing operator documentation.

Post by Yukiko »

Ok. I don't think in light of the i+=, i-= etc. we are fine and I prefer the if...else...endif construct.
Post Reply