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: 2506
Joined: Thu Feb 02, 2006 1:41 pm
Location: San Antonio, Texas
Contact:

Missing operator documentation.

Post by Yukiko » Mon Jul 09, 2018 10:57 pm

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.
Sincerely,
Yukiko

I would tell you a UDP joke but you might not get it.

Titus 2:13

guialtran
Grandmaster Poster
Posts: 108
Joined: Wed Jul 30, 2008 12:42 pm

Re: Missing operator documentation.

Post by guialtran » Fri Jul 13, 2018 11:07 pm

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).
@CronosKing
Image ZuluHotel Forgotten Realms
www.zuluhotel.com.br

User avatar
atreiu
Grandmaster Poster
Posts: 144
Joined: Mon May 24, 2010 1:08 pm
Location: Russia, Moscow
Contact:

Re: Missing operator documentation.

Post by atreiu » Sun Jul 15, 2018 9:09 am

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
thanks a lot to all POL devs you've made my hobby!
my addon for comfortable eScript compilation will save your time
drugs&drop for compile new one
alt+q - compile last script

Yukiko
Distro Developer
Posts: 2506
Joined: Thu Feb 02, 2006 1:41 pm
Location: San Antonio, Texas
Contact:

Re: Missing operator documentation.

Post by Yukiko » Sun Jul 15, 2018 9:44 am

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 :)
Sincerely,
Yukiko

I would tell you a UDP joke but you might not get it.

Titus 2:13

DevGIB
Grandmaster Poster
Posts: 204
Joined: Mon Feb 06, 2006 6:12 am

Re: Missing operator documentation.

Post by DevGIB » Sun Jul 15, 2018 8:40 pm

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: 2506
Joined: Thu Feb 02, 2006 1:41 pm
Location: San Antonio, Texas
Contact:

Re: Missing operator documentation.

Post by Yukiko » Sun Jul 15, 2018 11:54 pm

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

I would tell you a UDP joke but you might not get it.

Titus 2:13

Post Reply