|
Wonderful! Many thanks. I was working on a patch but my C skills were not enough.
In the end, I'm not completetly insane at all.
On 06/06/2015 11:33 PM, Rodrigo Azevedo wrote:
I have made a power patch that includes this. You can download it from here: http://lua-users.org/wiki/ThomasJericke3.4.10 – Function Calls
The form
functioncall ::= prefixexp ‘:’ Name args
Arguments have the following syntax:
args ::= ‘(’ [explist] ‘)’ args ::= tableconstructor args ::= LiteralStringcan be used to call "methods". A call
v:name(args)
is syntactic sugar forv.name(v,args)
, except thatv
is evaluated only once.-------------------
Let v be a usardata with a unary method, then
v:abs() is a syntatic sugar for v.abs(v)
v:reduce() is a syntatic sugar for v.reduce(v)
etc
This notation is very unpleasant. There is a problem if this behaviour of function calls
v:abs is a syntativ sugar for v.abs(v)
v:reduce is a syntatic sugar for v.reduce(v)
was valid?
If not, I really appreciate this new flavor.
--
Rodrigo Azevedo Moreira da Silva
If you have made some test with it, I would appreciate some feedback if it works as supposed.
--
Thomas