lua-users home
lua-l archive

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




On 2017-08-29 04:55 AM, Eike Decker wrote:


2017-08-28 20:19 GMT+02:00 Egor Skriptunoff <egor.skriptunoff@gmail.com <mailto:egor.skriptunoff@gmail.com>>:

    On Mon, Aug 28, 2017 at 7:29 PM, Soni L. wrote:

        A while back I talked about component syntax, which I
        described as `a:b.c()` and `a:[b].c()`.


    And what does this syntax mean?


As far as I understand the colon is a capturing instruction to push the table that was accessed on the stack and keep it in first position until a method call comes along. If no method call happens in the chain of table accessing, that would be a syntax error during compile time.

Thus:

a:b.c()

becomes

local v = a.b
v:c()

I think it would work and I think it could be used to great use, but every time I see myself explaining how the colon syntax works I start scratching my head if it isn't just too complicated already...

It can be simply explained as "rust traits in a scripting language", "component syntax", etc.

--
Disclaimer: these emails may be made public at any given time, with or without reason. If you don't agree with this, DO NOT REPLY.