lua-users home
lua-l archive

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


Op Do. 25 Apr. 2019 om 03:33 het Philippe Verdy <verdy_p@wanadoo.fr> geskryf:
>
> I also agree that the "*xxx" or "*(xxx, params...)" syntax is very fuzzy and will not work with the future evolution of annotations
>
> Le jeu. 25 avr. 2019 à 00:22, Dibyendu Majumdar <mobile@majumdar.org.uk> a écrit :
>
>> I am writing about this again in the hope that it is not too late to
>> change the syntax of the *toclose attribute. 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.

The ASCII character set consists of 32 control characters, 1 space, 1
delete charater, 10 digits, 52 letters and 32 punctuation characters
(i.e. those that match '%p').

Of the "punctuation" characters, only five have as yet no meaning in Lua.

33    !   exclamation mark
36    $   dollar sign
63    ?   question mark
64    @  at sign
96    `    baclquote

All five carry baggage in the form of a standardized meaning in C
and/or Unix. Among these, the exclamation mark stands out as one in
which the decision not go with that standardized meaning has already
been made. There is no expectation that it will ever mean `not` in
Lua.

Therefore I would suggest that an annotation starts with ! and
continues until but not including the first termination character.
Sensible termination characters might be comma, semicolon and end-of
line, allowing annotations for every item in a parameter/return list,
table constructor etc, but not encumbering the parser with a difficult
decision whether the annotation is done. In the contex of "local", an
empty annotation could default to 'toclose', so that "local a!, b, c!`
is all that one needs to supply "toclose" directives.

Support for annotations could be anything from nothing to customized.
That is to say, an unrecognized annotation should not be an error.

-- Dirk