adding support for Jedi Command

2 views
Skip to first unread message

kbwelker

unread,
Feb 21, 2012, 2:24:00 PM2/21/12
to Funcito
interface Command<T> defines a void execute(T t) method, for defining
generic operations on type <T>, where what is desired is the side-
effect rather than a return value. This flies in the face of the FP
requirement of immutability. In that regard, one might argue that it
was "wrong" for Jedi to include it in their library.

However, I don't care, because I find the concept very usable in Java
hich regardless of FP-like frameworks is still an imperative
language. Within the framework of Jedi itself, the foreach(),
sequence() and powerset() methods of FunctionalPrimitives have value
in implementing common imperative concepts very tersely. And apart
from the Jedi framework itself, I can see how one could use the
Command interface as a passable typed-Method pointer for void
methods. I have not found anything comparable in Guava or FJ
(understandably).

For that last reason, I would even consider implementing a similar non-
library-specific interface. But we might explore whether or not a
concept such as Guava Function<T,Void> or FJ F<T,Void> makes any sense
before we jump into creating our own Funcito-only wrappers.

kbwelker

unread,
Mar 1, 2012, 6:16:38 PM3/1/12
to Funcito


On Feb 21, 1:24 pm, kbwelker <kandpwel...@gmail.com> wrote:
> I have not found anything comparable in Guava or FJ (understandably).
>
> For that last reason, I would even consider implementing a similar non-
> library-specific interface.  But we might explore whether or not a
> concept such as Guava Function<T,Void> or FJ F<T,Void> makes any sense
> before we jump into creating our own Funcito-only wrappers.

I think the FJ equivalent is the Effect class.

kbwelker

unread,
Mar 2, 2012, 12:48:45 PM3/2/12
to Funcito
There is *not* anything in Guava like this, and they are currently
opposed to adding Command<T>.

http://stackoverflow.com/q/9525951/433348
Reply all
Reply to author
Forward
0 new messages