lua-users home
lua-l archive

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




Dibyendu Majumdar <mobile@majumdar.org.uk> 于2019年6月2日周日 下午11:33写道:
I hate the syntax for the Rust language. It kind of spoils it for me.

Do people find anything ugly about current Lua syntax?
What about the proposed new syntax <toclose> and <const>?

Regards
Dibyendu


I still insist to suggest the colon syntax:

local x: toclose = reosurce

x:anno syntax can used in expressions, just because currently x:anno is not a valid Lua syntax. Lua requires a '(' after Name:

prefixexp ':' Name '('

So, we just do not append a '(' after the name, like this:

local x = a:integer + b:integer

It's invalid in current Lua.

or like this:

(a:integer[])[10]

for multiple annotations, this should works:

local x:toclose:MyClass = MyClass.new()



--
regards,
Xavier Wang.