lua-users home
lua-l archive

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


> I would suggest that the syntax should be:
> 
> <special character><optional name><optional table with only literal
> keys and values>
> 
> So assuming your choice of !, we could have:
> 
> local a!
> local b !go_to_space { when=true }
> local c !array { 20 }
> 
> By allowing an optional table after the name would enable a whole host
> of possibilities without breaking the lexer / parser I hope.

Personal tastes aside, I fail to see how this differ from the current
status. These variations would work there, too:

local *a
local *go_to_space{when=true} b
local *array{20} c
local *go_to_space{when=true}, *array{20} myvar = ...

To make myself clearer, you wrote:

  I think there is an opportunity to allow a general way of introducing
  annotations in Lua, which can be exploited by extensions. It would be
  sad if that opportunity is lost.

What I don't see is how '!' (versus '*') or postfixed (versus prefixed)
are more appropriate for this "general way of introducing annotations in
Lua".

I also don't see why, in the presence of other options, 'toclose' would
be the default. Is it more common/important than a possible '*const' or
'*immutable'? More common than any attribute that is yet to be created?
(Note that we added 'toclose' to the syntax exactly to allow future
extensions.)

-- Roberto