Re: String concatenation design



Ben Pfaff wrote:
"Rob Thorpe" <robert.thorpe@xxxxxxxxxxxx> writes:

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?

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

That's not a general dictum. It's specifically in reference to
splitting a long expression into multiple lines.

For the GNU style you're right.

I'd point out also though that the GNU style recommends the use of
Emacs. Emacs C-mode makes writing long conditional expressions easier,
because it gets their indentation more often correct than other
editors. The point it makes here is in order to improve indentation of
expressions though, showing that their handling isn't perfect.

Relying on this in C & C++ programs in general is difficult though,
since C programmers tend to like using simple editors.

I first came across this problem when I wrote a module of a C program
with several relatively complex expressions that used many precedence
levels. The other programmer working on it complained because he
couldn't understand them, partly because the editor he was using
couldn't indent them.

.



Relevant Pages

  • Re: Dangling else
    ... If a language doesn't have precedence levels, then such expressions ... account is just badly designed, ...
    (comp.compilers)
  • Abstract and concrete syntax
    ... That's what interests me in Python. ... Statements are not expressions. ... cannot fit the indentation sensitive syntax. ... Python allows statements inside suites and suites inside compound ...
    (comp.lang.python)
  • Re: String concatenation design
    ... What evidence is there to support your claim that the precedence levels ... are unpopular? ... The GNU style guide is milder: ... expressions] shows the nesting:" ...
    (comp.programming)
  • Re: So, did Jeff know?
    ... They showed James looking shocked about something JP ... The editors are going to pick the best expressions they ... I hate when they do that because it can make the contestants seem ... That's sort of the risk they take when they show big expressions. ...
    (alt.tv.survivor)
  • Re: Python Style Guide Questions
    ... former - especially since namespace wont be dirtied. ... uses whitespace as indentation, I keep confusing the block indentation ... using 'thought-sized' expressions. ... Thank you Steven and TJR. ...
    (comp.lang.python)