lua-users home
lua-l archive

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


On 2/16/2010 7:51 PM, Asko Kauppi wrote:

A better solution may be to _not_ use the : syntax at all.

I've recently crafted an API for non-programmers, and decided to make the whole object system using dot notation. Exactly for the reason of not confusing the users on when they need dot, when colon. It's always dot.

This is performed by sending the 'this' object as upvalue to all the methods. It may give a slight runtime penalty but I doubt it's even measurable. Can show you sample if you are interested, but the technique has been mentioned on the list before.

-asko

Hi Asko,

If you wouldn't mind, I'd like to see a sample. Your approach may work better for me than some of the other proposals here because I'm using Lunar to do my binding, and I do not have direct access to the object without modifying Lunar, which I'd prefer not to do.

I do have some reservations about teaching programmers bad habits, but I'm not sure that that's what your system does. I do see immense appeal in eliminating a very common and difficult to detect error.

Thanks,

Chris