commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Matt Munz" <mm...@apelon.com>
Subject [functor] Uses for Functors
Date Fri, 19 Sep 2003 18:55:53 GMT
Hi all,

  After reading "Blocks in Java", I'm pretty sure that Functors/closures are useful in certain
instances.  I'm unfamiliar with the topic, however, and would like to gain a sense of in what
scenarios they are best used.  In the use of collections / iterators, and in the serialization
of algorithms (command pattern), the applicaton of Functors seems clear to me. Are there other
common application areas?

  For example, what about event mechanisms?  Some languages use method pointers for this purpose.
 Is there any sense in using Functors as event listeners?  I'm considering making a sort of
universal adapter that would adapt a given functor to any of the event listener interfaces.
 Does this make sense?  Has anyone tried using (java) Functors in an event-based system (GUI)?

  Additionally, what about combining Functors with reflection?  To invoke a method using reflection,
one needs the object to act on and the name of the method to invoke.  This state can be stored
in a proxy object, but perhaps a Functor / closure is a good choice for this?  Doing so would
allow any object to be adapted to a (set of) Functor(s) at Runtime.  Similarly, interception,
logging, etc., could be provided by a chain of Functors.

  I hope my questions aren't too newbieish ;)  Thanks for creating an interesting project.

  - Matt Munz
    mmunz@apelon.com


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message