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.

Ulrich.

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... :)

Ulrich.

Am 19.04.2016 um 13:11 schrieb Luiz Henrique de Figueiredo:
   :method instead self:method
and
   .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
    end

but call methods with the colon syntax:

    myObject:myMethod(...)

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