Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

The Ex-Precedence Table

A customer returns to a familiar shop.

“I’d like to complain about this precedence table I purchased.”

“What’s wrong with it?”

“It’s got twenty-one levels.”

“That’s a feature, sir. Twenty-one carefully ordered levels of operator binding priority, each with its own associativity rules — left-to-right for arithmetic, right-to-left for assignment, and a special case for the comma operator that nobody has ever used intentionally.”

“I’ve never seen so many bleedin’ levels of operator binding priority.”

A long, uncomfortable pause. For the customer, anyway; the proprietor remains positively indefatiable.

“I can’t remember whether ** binds tighter than unary minus.”

“It does, sir. That’s level four versus level fifteen.” Pause. “Or is it the other way round.” A longer pause. “Let me check.”

“That doesn’t sound like a very lively thing to me.”

“Oh, but it is, sir! Very lively – very lively, indeed!”

“But it’s not doing anything. It’s just lying there, being a mess!”

“What about this one?”

“That’s not a precedence table!”

“Indeed, sir! It doesn’t have any precedence tables!”

“What are all those, then?”

“Par-entheses!”

The customer looks down at (+ 1 (* 2 3)). No ambiguity. No table. No levels. Just trees.

“Right, then – I’ll take it.”