← Prev in month ← Prev in thread

Let's make "^" left-associative, not right-associative

From
David A. Wheeler <>
Date
2006-07-15T13:50:56+00:00
ID
Thread
Let's make "^" left-associative, not right-associative
In nearly all spreadsheet applications, ^ is left-associative, including
Excel, OpenOffice.org, Lotus 1-2-3v9.8, and Corel Quattro Pro.
That means 2^3^2 is all those cases is 64, not 512.
Gnumeric 1.4.3 is an exception, it's right-associative.  Don't know about KOffice.

Therefore, I believe we should change "^" to be left-associative
for the file exchange format, NOT right-associative. Right-associative
is slightly more conventional in the non-spreadsheet world, but
not strongly so, and clearly left-associative is by FAR the most common
convention in the spreadsheet world.  Also, very
few people really want to DEPEND on having "^"
be right-to-left (they'd insert parens in the rare case where
they use it) -- and by having all binary operators left-associative,
we simplify implementation for those who hand-craft their parser.

As usual, this is only for the interchange format;
if an application (like Gnumeric) wants
its UI "^" to be right-associative, that's fine.  But I expect most
spreadsheet applications will follow the conventions of the
exchange format, so I think the associativity rules should follow
the more common case.

I'm making this mod to the current draft, and added some
tests to verify it.  Let me know if there's a crisis!

--- David A. Wheeler
← Prev in month ← Prev in thread