commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Arnd Kohrs <>
Subject Re: [functor] some thoughts
Date Fri, 28 Mar 2003 17:46:56 GMT
>>>>> "Rodney" == Rodney Waldhoff <> writes:

    Arnd> - functors are very often defined (in my experience) as anonymous
    Arnd> inner classes, therefore it would be nice if the to be
    Arnd> implemented methodname is as short as possible for not
    Arnd> compromising the readability of the code.  I would suggest
    Arnd> "eval()" instead "evaluate()", "is()" instead of "test()" and
    Arnd> "run()" is already short.

    Rodney> The letters "uate" are a rather small part of what makes
    Rodney> defining blocks as anonymous inner classes in java
    Rodney> syntactically awkward, but there may be something to your
    Rodney> argument there.  While I have an opinion, any isomorphic
    Rodney> representation of these interfaces is pretty much OK with
    Rodney> me.

Now that you write it, it is as well obvious to me that "eval" is in
fact an abbreviation and does not exist as an english word (at least
outside of the tech (err ... that is 'technology' ;-) community).

In general I do not like abbreviated words as identifier names.  My
reasoning is that it obfuscates the programmers intention and may
imply futile documentation.  I don't think that "eval()" obfuscates
"evaluate()", but this is obviously just my opinion since "eval()"
does appear awkward to you as a replacement for "evaluate()".
    Arnd> - IMHO "Predicate.test()" is (in a world of JUnit testers) a bit
    Arnd> misleading, since "test" has overloaded semantics.  I like
    Arnd> "is()".

    Rodney> I'm also a little troubled by Predicate.test, but more so by
    Rodney>  My thinking was that in most cases, the
    Rodney> method-name for the functor is a verb that can be applied to
    Rodney> the functor.  I.e., you "run" a Procedure or "evaluate" a
    Rodney> Function, but you don't "is" a Predicate.  (And similiarly,
    Rodney> you could look at those verbs as applying to the arguments
    Rodney> of those functors.) My preference would have been for
    Rodney> Predicate.assert, but that's out for obvious reasons, or
    Rodney> Predicate.evaluate, but I think we want to keep the Function
    Rodney> and Predicate signatures different.

Your arguments are coherent for the current method names and I tend to

In principle all functors are Functions.  Predicates are functions which
have boolean results.  Procedures are Functions which have VOID results.
So these three concept may all be "evaluated".  But for Procedures we
know already that the result is not interesting therefore they the
associated action may be "run" which does not imply a result (as
"evaluate" does).  Furthermore Predicate is a Function which if
evaluated produces a boolean result.  Using "evaluate" as an action
would not imply the contraint result type.  However "is" does imply that
the outcome is boolean.  So from this 'result' angle "is" may not be
such a bad choice.

    Rodney> Recently it occurred to me (following the language Backus
    Rodney> uses in "Can Programming Be Liberated from the von Neumann
    Rodney> Style?"
    Rodney> <>,
    Rodney> and is sometimes used in mathematical circles) that it might
    Rodney> be reasonable to say you "apply" a Function (i.e.,
    Rodney> Function.apply), which would free up evaluate for the
    Rodney> Predicate method.

I could agree on "apply" (if it leads to eliminating "test"). However
"apply", does in my limited english language understanding not imply a
result and a result is somehow what is interesting when using a



To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message