Re: String concatenation design




Rob Thorpe wrote:
andy@xxxxxxxxxxxxxxxxxxxxxxxxx wrote:
Rob Thorpe wrote:

Don't do what C, C++ and Perl do, and have 15 levels with slightly
different priorities. These languages are popular but their precendence
levels aren't.

What evidence is there to support your claim that the precedence levels
are unpopular?

From the Indhill style guide:
"Since C has some unexpected precedence rules, expressions involving
mixed operators should be parenthesized." & later "There is a time and
place for the binary comma operator, but generally it should be
avoided."

"some" is not the same as all.

The GNU style guide is milder:
"Instead, use extra parentheses so that the indentation [of
expressions] shows the nesting:"

Plus I've never read a program of any length that used many of the
precedence levels at once. And most programs I've read seems to ignore
many of them, often relying on * . -> + - * / && || = == only.

Think about this: can you remember what they all are? For C and C++?

If they were changed I would be extremely annoyed because I would have
even less chance of remembering what they are. AFAIK a good subset is
the same across a wide number of languages too. That helps when
learning a new language. Hands off operator precedence! Thats what I
say.

cheers
Andy Little

.



Relevant Pages

  • Re: String concatenation design
    ... These languages are popular but their precendence ... What evidence is there to support your claim that the precedence levels ... but the large number of levels of priority in C and C++ cause ... I've written expressions before that did something subtly ...
    (comp.programming)
  • Re: String concatenation design
    ... What evidence is there to support your claim that the precedence levels ... are unpopular? ... place for the binary comma operator, ... use extra parentheses so that the indentation [of ...
    (comp.programming)