lua-users home
lua-l archive

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

Or much more simple solution:
Stick on the mandatory ";", And if someone want to use my proposed
shortcut he HAVE to write a ";" between the previours statement and the
shortcut.So nothing changes for the existing sources.


Am 19.04.2016 um 13:30 schrieb Ulrich Schmidt:
I see. This is the only one point i assume, was the wrong design
decision: Omit the explicit statement delimitter ";"

I like the clean and simple syntax and i am with you being cautious
implementing new more specialized language features. But requiring
a explicit command delimiter ";" would open the possibility to
implement some tiny and useful syntax extensions. We need to update
existing sources, but this should be easy to do. And the readability of
sources becomes better and easier to understand. And.. and .. and... :)


Am 19.04.2016 um 13:11 schrieb Luiz Henrique de Figueiredo:
   :method instead self:method
   .field instead self.field

When you define methods, use the full syntax and choose a one-letter
variable instead of self:

    function MyClass.myMethod(O, ...)
        return O:f() + O.n

but call methods with the colon syntax:


Your proposal is ambiguous syntax:
    a = b
is the same as
    a = b:method()