commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Steve Downey <steve.dow...@netfolio.com>
Subject Re: [lang] Proposal for *NEXT* version
Date Thu, 03 Oct 2002 16:35:26 GMT
Only if you can explain why this version is NOT the same as the "evil", 
"destructive", <choose your own negative adjective> one that Microsoft 
implemented in J++.

Or maybe people have forgotten that by now.

For the record, I thought they were a good idea when Anders first introduced 
them. They were a lot cleaner than the cruft introduced by AWT. 

I think there's likely some synergy between this and some of the proposals 
floating around for reflection utilities.

On Thursday 03 October 2002 10:40 am, Berin Loritsch wrote:
> The Avalon team has learned how the language features of C# can help us
> write better and more intelligent software.  However, since none of us
> really has the money or inclination to completely tie ourselves to C#
> or M$, we want to add language features in a Java way.
>
> We threw together a way to generate Delegates.  A delegate is like a
> method pointer, but it is also able to be treated like an Object.  The
> benefit of this is that we can pass in the delegate to a method, and
> change the behavior of that method substantially.
>
> The perfect example where this pays off is with Intelligent Agent
> design.  The Intelligent Agent is the building block of artificial
> intelligence.  There are four or five basic algorithms for searching
> through a problem space to find the best solution.  These algorithms
> require you to pass in functions.  Delegates make all this possible,
> without forcing the original class to have the same name.  For example:
>
> interface NewComparator
> {
>      int compare( Object orig, Object other );
> }
>
> class ComparitorHeaven
> {
>      public int compareClassName( Object orig, Object other )
>      { /* implementation */ }
>
>      public int compareEquals( Object orig, Object other )
>      { /* implementation */ }
> }
>
> With the two declarations above, I can write a search algorithm
> like this:
>
> public Object findBestObject( String method )
> {
>      ComparatorHeaven ch = new ComparatorHeaven;
>
>      NewComparator checker =
>         (NewComparator) Delagate.newDelagate( ch, method );
>
>      Iterator it = m_myList.iterator();
>      Object prev = it.next();
>
>      while( it.hasNext() )
>      {
>          Object curr = it.next();
>          int preference = checker.compare( curr, prev );
>
>          prev = curr;
>          // perform actual decisions based on preference
>      }
> }
>
>
> We have some initial stuff checked in to Excalibur Util.
> When we are done shaping it up, we would like to give it
> to Commons Lang.  I realize you are getting ready to make
> a release, which is why I don't want to push it for this
> release.  What are y'alls thoughts?


--
To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>


Mime
View raw message