lua-users home
lua-l archive

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

On 22-Sep-04, at 2:06 PM, Bilyk, Alex wrote:

With all it's limitations and peculiarities of [mis]use in some contexts I fail to see how Lua would benefit from this on one hand, while I also fail to see what is wrong with

function_obj("msg", ... )

to begin with. The above form, while marginally longer to type, is clear to anyone and works for any string.

Well, that was my first reaction, too. But when I started to think about it, particularly when playing around with implementing objects as coroutines, I realised that it is nice to be able to do:

  obj:method(arg1, arg2)

without having to know whether obj is a traditional table-based object, or a function-based object. (In other words, the implementation of obj could change without having to change consumers of the object.) Of course, you could write a wrapper for obj to make it work properly, but Mark's idea seems like a nice way of getting around having to do that.

So (I presume) it would be specifically for that case, in which case it is not really that limited or peculiar.