lua-users home
lua-l archive

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

On Fri, Feb 22, 2019, 08:54 Philippe Verdy < wrote:
I also think that the "*" syntax in declarations is very tricky, and in fact confusing (for most C/C++ programmers).

I would much prefer a syntax using annotations (like in Java and other languages, using "@" instead, or like in C/C++ using a keyword in the declarator, with a parameter specifying the annotation/usage we want.
The use of "*" alone does not allow any further development or generalization for annotations.

So I suggest instead:
  local n, @toclose cl, @toclose(options...) cl1, @todo(things) cl2

And then create a object-oriented framework for these annotations (not just this syntax but a way to declare each "@identifier" as a sort of "metaclass" with properties, methods, metatable, and specify those "@identifier" that are ignorable, and those that are builtin and will become part of the language later (and may be checked at compile time, or load time, or run time...
These annotations can augment the type system, can help compilers to find useful hints, can help code generators or code refactoring tools in source editors, can help document the objects/classes, can specify implementations limits, contracts, and check them when reusing components, can be used to infer proxing objects, can specify the transactional model (for transaction coordinators, working with both loal and remote objects).

This sounds a lot like Python's decorators.