lua-users home
lua-l archive

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


I've long wanted a few extensions to the behavior around the colon operator:

1. o:m not followed by parameters should do a bind. My inclination is to do the method lookup at the time the binding is created. I wouldn't worry about storage allocation provided no binding was generated on an actual call. This sort of construct is useful whenever building a system with callbacks. The caveat is that it would create strong rather than weak links.

2. o:[ mexpr ]( ... ) would allow for computing the method name in a dispatch. (This is actually a pretty easy compiler change.)

3. The combination of 1 & 2. (Less obviously useful but a natural point of completeness.)

I used to want the colon operator raised to first-class status where it could then have a metamethod, but I never found a formulation that really seemed useful. (Someone can go find my old postings on the topic and point out how much I forget...)

Mark