lua-users home
lua-l archive

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


1. Programming languages shouldn't use/allow nonprintable characters
except perhaps in (long/raw) string literals.
2. Would break existing code and introduce many syntactic ambiguities.
Consider the simple p = print. Is this an assignment p = print() or an
assignment p = print?
3. Again a nonprintable control character. Adding hyphen would introduce
ambiguities, breaking existing code again: Is a-b the name a-b or the
subtraction a - b?
4. Again ambiguities: Is x=f "blah" the assignment x=f followed by the
comment "blah", or the assignment x=f("blah")?
5. Not an option, would introduce ambiguities and break existing code -
comma, period and colon all already have meanings (arglist / varlist /
table entry separator, indexing operator, implicit self parameter
syntactic sugar). Treating them like semicolons (usually unnecessary
statement delimiters) would break practically all existing code. Some
examples: Is f().x=2 equivalent to f();x=2 or f()["x"]=2? Is f():g()
equivalent to f();g() or local self=f();self.g(self)?

The support of nonprintable characters would be easy to implement, the
rest not so much; it isn't even well defined.

- Lars

On 01/10/2023 13:41, Claudio Grondi wrote:

Lua would require some minor changes only, which if I am not mistaken
won't break any past code and should be relatively easy to implement,
in order to support natural language texts as valid script code.

May someone help me to provide proof of the concept explaining where
and how to modify Lua C-code in order to:

1.    allow ASCII values 0x02 (Start of Text) and 0x03 (End of Text)
to be used in script code and interpreted respectively as `[[` and `]]`

2.    allow function calls by specifying the function name only
(without using braces and without the need of passing a parameter)

3.    extend [_a-zA-z0-9] characters allowed in symbol names with
ASCII value 0x1F (Unit Separator) and `-` which will be treated like
[0-9] not allowed as first symbol name characters

4.    allow usage of unnamed strings (i.e. string literals which can
be specified anywhere in code without the need of assigning them to a
symbol) ignoring them like comments

5.    allow next to `;` also usage of `,` , `.` and `:`

?