> [Original Message]
> From: Bernhard Fastenrath <[EMAIL PROTECTED]>
> To: Jakarta General List <[EMAIL PROTECTED]>
 > Date: 10/26/04 2:09:02 PM
> Subject: Re: FW: RE: Future JDK features 2 items
>
> Dan Lydick wrote:

> 

> >> <>From: Danny Angus <[EMAIL PROTECTED]>

> >

> >>1/ Ok don't flame me... "Method pointers"

> >>    

> >>

...
> >>    

> >>

> Your example can as easily use class references as it can be written 

> using method pointers.

> Where's the advantage of a method pointer?

> 

Maybe Mr. Angus wasn't going here, but behind my
concept was work I have done in C/C++ with arrays
of function-through-pointer for varied functionality
depending on context.



> class ImplementsComparable {

> }

> 

> sampleCompareMethod (ImplementsComparable comparableObject,

>                                         Integer compareWith)

> {

> }

> 

This approach might do the job just as well.

What say you, Danny Angus?



> 

> If the parameters have different names it's likely they have different
types so

> you would probably want to invoke methods with the exact same parameter
list,

> which defeats your argument that not knowing parameter names is an
advantage.

The naming of C/C++ parameters in function prototypes is often skipped
as long as the type is known.  Nobody cares except the implementation
of the actual method.  The downside is that you have to know the
exact prototype in order to reference it, and prototype header files is
part of what Java is trying to get away from.



> 

> The main difference is that in the earlier piece of code methods are
wrapped

> in inner classes, which amounts to about 30 additional characters you
have to

> type: "class FooBar { ... } implements I" for each class, one
instantiation

> for each class and a common interface.

> 


Good point.  Thanks for your observation.



Dan Lydick




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to