Page 1 of 3
ARexx "not not" bug
Posted: Fri Apr 21, 2017 2:56 pm
by polluks
Hi!
Works
Does not work
30 years hidden
Re: ARexx "not not" bug
Posted: Fri Apr 21, 2017 3:25 pm
by thomasrapp
Not really a bug. It does not give wrong results, it issues an error message. So it's more a restriction than a bug.
Re: ARexx "not not" bug
Posted: Fri Apr 21, 2017 4:09 pm
by broadblues
polluks wrote:Hi!
Works
Does not work
30 years hidden
Definetly not a bug at all. Operators are made of 1 or 2 symbols so '|' and '||' are both valid operators with different meaning, first means 'or' second means 'concatenate' . '~' means 'not' but '~~' has no meaning assigned therefore throws up an error
If by some chance you really need 'not not' you need to use parenthesis, as in your first expression, though most usualy you can probably simplify you expression to remove the nots as they cancel out.
Fairly sure the same would work in C (!! expression) would give an error. !(! expression) would work.
Re: ARexx "not not" bug
Posted: Fri Apr 21, 2017 6:24 pm
by salass00
broadblues wrote:
Fairly sure the same would work in C (!! expression) would give an error. !(! expression) would work.
Actually "!!value" does work in C and is commonly used to normalize arbitrary zero/non-zero boolean values into being either 0 or 1 for false and true respectively.
Re: ARexx "not not" bug
Posted: Fri Apr 21, 2017 6:36 pm
by thomasrapp
~~ also works in Rexx on IBM mainframe.
Re: ARexx "not not" bug
Posted: Fri Apr 21, 2017 10:33 pm
by nbache
thomasrapp wrote:~~ also works in Rexx on IBM mainframe.
Interesting - what does it work as? Because my recollection from when I used Rexx on IBM mainframes was that the logical NOT operator isn't a tilde at all, but a proper "not" sign ("¬") or alternatively a backslash.
The tilde as NOT is an ARexx speciality.
Best regards,
Niels
Re: ARexx "not not" bug
Posted: Sat Apr 22, 2017 9:49 am
by thomasrapp
nbache wrote:thomasrapp wrote:my recollection from when I used Rexx on IBM mainframes was that the logical NOT operator isn't a tilde at all, but a proper "not" sign ("¬")
Sorry, I wasn't clear. Of course I didn't try ~~ but the equivalent of "NOT NOT" which is ^^ using the German code page.
Re: ARexx "not not" bug
Posted: Sat Apr 22, 2017 5:03 pm
by nbache
thomasrapp wrote:Sorry, I wasn't clear. Of course I didn't try ~~ but the equivalent of "NOT NOT" which is ^^ using the German code page.
Ah, right. Yes, I also remember the caret being an alternative with some charsets.
Anyway, since each implementation of the language obviously has its own choices regarding (among other things) operator implementation, I don't regard it as a bug that the ARexx implementation parses the double NOT as one two-character operator (which happens to be undefined) rather than two consecutive NOT operators.
There are several other, larger differences between ARexx and Rexx; IIRC a number of builtin functions in ARexx are not found in Rexx. The author had good reason to name his implementation ARexx rather than Rexx for Amiga or similar.
Best regards,
Niels
Re: ARexx "not not" bug
Posted: Sat Apr 22, 2017 11:47 pm
by polluks
Sorry guys,
all prefix operators are broken:
If you take a look in the "bible":
"There may be one or more prefix operators to the left of any term."
https://books.google.de/books?hl=de&id= ... refix+plus
C'mon, our implementation is not a decision by design but simply incomplete.
It's slower, you have to parse extra parentheses.
Re: ARexx "not not" bug
Posted: Sun Apr 23, 2017 7:48 am
by thomasrapp
What sense does it make to invert an inverting operator? Instead of ~~0 you could write just 0. Would be even faster, no operator to parse at all.