lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]



On Dec 9, 2012 12:58 PM, "Dirk Laurie"

> This does not mean that I accept Jay's point about implicit parentheses — but
> Denis has taken that up, allowing me slink away quietly in disgrace.

I'm ready to slink away too; the Scheme order-of-evaluation flamewar is about to arrive, and I hate all of it. So I'll throw this smoke grenade into the room to cover our escape:

I can't remember which Scheme (Dylan?) proposal had a deterministic but pointedly unintuitive order, something like:

  1. Even-numbered arguments are evaluated left-to-right;
  2. The function _expression_ ("0th arg") is evaluated.
  3. The odd-numbered arguments are evaluated right-to-left.
  4. The function is applied to the arguments.

This breaks code with false assumptions from other implementations yet is consistent between runs.

Consider the following expressions: which are defined not to print hello?

   return assert((nil)(), print("hello"))

   return (nil)() .. print("hello")

   return (nil)() .. (print("hello"))

   return (nil)(), print("hello")

   return (nil)() or print("hello")

Jay