lua-users home
lua-l archive

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


Peter Hill wrote:
> As far as homogenising changes go, I'd move all atomic items (not just
> "function") out of "exp" and into "prefixexp" where they belong.

Eero Pajarre:
> I did a quick test, and the change seems trivial.
>
> Modified Lua seems to be able to run in my application, and now
> print(3(3)) is an "attempt to call a number value" error instead of syntax
> error.
>
> Saying this does not mean that I like or recommend this change ;-) (I am
> now actually reverting back to the original code in my application)

I personally find "3(3)" to be a rather odd beast myself. However, in Lua4
(with its tag methods) one could redefine the "function" tag method of
numbers to have some desired meaning. So:
    a=3
    a(4)
would actually be executable code, while:
    3(4)
remained illegal. Totally inconsitent.


In Lua5 with its metatables the nature of things seems to have changed, so
I'm not sure what is now most natural way. Regardless, one *should* be able
to have:
    function(a) return a end (123)

*cheers*
Peter Hill.