RE: NASL2: precedence of 'logical NOT'
"Jim Cervantes" <[email protected]>
| Newsgroups | gmane.comp.security.nessus.devel |
|---|---|
| Message-ID | <[email protected]> |
I just checked the operator precedence for Perl, TCL, PHP, Java and C/C++. They all put unary operators at the highest levels of precedence and as well place "comparators" at the lowest levels of precedence. I may be giving bad examples of languages. Can you name other popular languages that have the kind of precedence relationship between unary operators like '!' and comparator operators like '==' ? I really think you are setting people up to be confused and having to code against their intuition. Just my two cents! Jim > -----Original Message----- > From: [email protected] > [mailto:[email protected]]On Behalf Of Michel Arboi > Sent: Sunday, February 16, 2003 4:20 PM > To: Jim Cervantes > Cc: Nessus Devel > Subject: RE: NASL2: precedence of 'logical NOT' > > > On Sun, 2003-02-16 at 10:12, Jim Cervantes wrote: > > Isn't it true that most programming languages give unary > operators very high > > precedence? > > Well, that's what C does. But I'm not sure it is a good example (e.g. > the precedence of & and | is *bad*) > > > I have always found this easy on the brain since it translates > > into unary operators always binding to tokens that immediately follow. > > Won't most people with at least some programming experience > find what you > > are suggesting to be unfamiliar? > > Then there is another possibility: implement additional logical > operators (and, or, not) with very low precedence, like in Perl. > > ! x == y <=> (! x) == y > not x == y <=> ! (x == y) > > This means that ! x >< y is buggy code. > egrep '! *[_a-zA-z0-9-]+.*><' *.nasl does not return any suspicious > code in the current plugins. > > And it seems that nobody had the bad idea of calling a variable 'and' > 'or' or 'not'. Good. > >