[Date Prev][Date Next][Thread Prev][Thread Next][Author Index][Date Index][Thread Index]

Re: [zzdev] Re: [zzdev] Proper abstractions



On 20001022T232924+0200, Benjamin Fallenstein wrote:
> Tuomas Lukka wrote:
> > I like the paradigm of callbacks - possibly I'm just showing my Perl
> > background where something like that would have been especially easy, with
> > anonymous subroutines. For some reason I've never liked the idea of
> > enumerations. I don't know why.
> 
> In our case I feel it makes the code easier. If we where talking about a
> language where anonymous subroutines are trivial, I might agree with you.

Anonymous subroutines are syntactic sugar.  If necessary, we can write
a preprocessor for an easier syntax.  However, I doubt that'll help us.

In this case, I must agree with Benjamin.  Java is not a functional
language[1] and so the functional style[2] is not really appropriate.
In C++, for example, which surprisingly well (although way too
verbosely) supports the functional style, one can expect the HOF[3]
and its argument method call be inlined into the body of the function
invoking that whole construct.  This is also true for many functional
languages with good compilers.  However,  I doubt that the Java class
system has been optimized for this kind of use.

*And* the HOF-style is very tedious to write in in Java.  I wish FlobSet
supported an Enumeration, as well :-)


[1] functional as in pertaining to functions; I will not go into the
argument of whether Java is a functioning language :-)

[2] Yes, that's what this is about.  Functions taking functions as
arguments are at what is often perceived as the heart of the functional
style.

[3] Higher-order function

-- 
%%% Antti-Juhani Kaijanaho % gaia@xxxxxx % http://www.iki.fi/gaia/ %%%