lua-users home
lua-l archive

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


On 6/8/12, steve donovan <steve.j.donovan@gmail.com> wrote:
> On Fri, Jun 8, 2012 at 1:34 AM, Jay Carlson <nop@nop.com> wrote:
>> I think the aesthetic argument is that code should be written vertically,
>> not horizontally,
> [...]
> So I guess the point is that  "expr:foo():bar():baz()" is not
> immediately recognized as "local e = expr; e:foo() e:bar() e:baz()"
> and we're back to the poor sod having to stop and examine things.
> [...]
>

I suppose that my argument is that in Java I would expect expr:foo()
to only change the state of expr (thus returning void) or don't change
its state and return something other than its internals that should be
passed to another object. In a functional language, where each
function is only defined by what goes in and what comes out, it makes
sense to return the same object modified.

In Lua, which is neither, I suppose I should not expect nothing in
particular - other than the Spanish Inquisition, just in case :-) .