commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James Strachan" <james_strac...@yahoo.co.uk>
Subject Re: [lang] Proposal for *NEXT* version
Date Fri, 04 Oct 2002 06:17:40 GMT
This all sounds great stuff.

It mirrors recent blog conversations on adding some other C# features,
namely accessing class attributes (which are implemented as javadoc tags
right now but could use JSR175 later on when we move to JDK1.5).

There's links to the various posts on the matter here...

http://www.brainopolis.com/roller/page/lance/20021003

It'd be nice to unify this stuff into a small reusable library.

James
-------
http://radio.weblogs.com/0112098/
----- Original Message -----
From: "Berin Loritsch" <bloritsch@apache.org>
To: "Jakarta Commons Developers List" <commons-dev@jakarta.apache.org>
Sent: Thursday, October 03, 2002 3:40 PM
Subject: [lang] Proposal for *NEXT* version


> 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?
>
>
> --
>
> "They that give up essential liberty to obtain a little temporary safety
>   deserve neither liberty nor safety."
>                  - Benjamin Franklin
>
>
> --
> To unsubscribe, e-mail:
<mailto:commons-dev-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail:
<mailto:commons-dev-help@jakarta.apache.org>
>

__________________________________________________
Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts
http://uk.my.yahoo.com

--
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