[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Overloading and extending operators
- From: roberto@... (Roberto Ierusalimschy)
- Date: Wed, 11 Apr 2007 11:20:18 -0300
> So, I am thinking of making a modification that generalizes operator
> handling, so that operators are defined in a table that provides for
> adding new operators, priorities, and associated meta-method names, as
> well as things like operator aliases. I think it could be done in a way
> that keeps the core code lightweight, but highly flexible.
> Is anyone else thinking about or working on something like this?
However, anything that affects compilation involves a lot of trouble
with modularity. For instance, we could use neither 'require' nor other
parts of the module system to load new operators. Also, these "modules"
defining new operators would need to be present at pre-compilation (if
one uses pre-compilation), which means that pre-compilation would need
pathes. There is also the problem of how to combine different "modules"
providing new operators, how these definitions propagate to 'loadfile'
and 'loadstring' (keeping in mind that this propagation has no effect if
the file or string is already precompiled), etc. In short, it is a whole
(In my personal view, this problem of managing definitions is more
complex and more important than the mechanism per se. I see it as the
main difficulty in designing anything that affects compilation, such as
macros, generic operators, etc.)