lua-users home
lua-l archive

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


Hi,
In lua functions are first class values, that's nice, because lua functions
can be used to customize behaviours the same way callbacks are used in C,
for example:

ok = Button()
ok.onClick.add( exit )

However, in an object oriented environment, you would not only want to use
functions but also object methods.

ok.onClick.add( app:exit )

that's not valid, but could be written as:

ok.onClick.add( app.exit, app )

the first sintax is more natural since you already do app:exit() to call the
method. I'm wondering if 'app:exit' could be expanded to 'app.exit, app'
when used as a function argument. In general that won't be desired, since
then you would be able to write things like:

a:f = b:f

and that would be replaced by:

a.f, a = b.f, b

that of course is not what you want.

What do you think about this proposal?



Ignacio Castaño
castanyo@yahoo.es

_______________________________________________________________
Yahoo! Messenger
Nueva versión: Webcam, voz, y mucho más ¡Gratis! 
Descárgalo ya desde http://messenger.yahoo.es