[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: idea of vision of blueprint of ROADMAP of Lua core
- From: David Given <dg@...>
- Date: Tue, 18 Jan 2005 10:30:50 +0000
On Tuesday 18 January 2005 02:42, Chris Pressey wrote:
[...]
> At any rate, the class that one writes that implements ActionListener
> doesn't have to implement anything besides actionPerformed, and for
> conceptual integrity of the design, probably shouldn't. So it still
> ends up being a "closure in object's clothing".
Absolutely. Java's EventListeners can only be described as half-assed; just
look at the Adaptor debacle for an example. And heaven help you if you need
to provide two different callbacks that have the same name.
Closures are definitely the way to go for this sort of thing. They make life
*so* much easier... the GUI system we're implementing where I work is mostly
written in C++, which doesn't have closures, and uses function callbacks
instead. These are fine for standalone applications, but not terribly
friendly for objects; you have to implement a static function that casts the
callback's user pointer to the appropriate type and calls a method on that.
However, function callbacks do have the advantage of being very lightweight
and customisable.
What does C# do? And Objective-C?
--
+- David Given --McQ-+ "Apatheism: the school of belief where on doesn't
| dg@cowlark.com | particularly care if there is/are god(s)." ---
| (dg@tao-group.com) | Capt. Gym Z. Quirk
+- www.cowlark.com --+