Issue 27: commentary on architecture
Project Member Reported by codeto...@gmail.com, Nov 29, 2011
I find myself trying to write Funcito, fittingly, in a functional style. To me, this means as little state as possible and preferably immutable state.

This is manifested in constructions like this:

new InvocationManager().pushInvokable(i);

Interestingly, I'm reasonably certain that we can reduce the state of Funcito down to:

(a) lone Invokable pointer in InvokableState
(b) StubFactory instance
(c) cache maps in StubFactories

I find this elegant, to the point where I am questioning (c), but more on that in another note.

The main 'rub' right now is that I would like to have Funcito create FuncitoDelegate in the constructor style as shown above. Same thing with InvocationManager and InvokableState.

Note that a trivial constructor is super-fast. One NFJS speaker said it is 10 bytecode operations.
Nov 29, 2011
Project Member #1 kandpwel...@gmail.com
Ironically I just checked in changes to remove this style, *before* I noticed this Issue :-) Sorry.  I am open to considering it.  I just don't see the value at this point.  With re-entrant methods, I don't see the harm in reusing once-constructed stateless objects, and you do save the construction AND garbage collection thrashing.  You will have to do a little more convincing to me on this one.  I'll leave the issue open for now...
Nov 30, 2011
Project Member #2 codeto...@gmail.com
Re: garbage-collection thrashing. This is wild speculation. We would have to profile to show evidence of that, and I bet that there will be no issues. Objects are inexpensive on modern JVMs.

My position is more objective: with respect to thread-safety, it is easier to reason about state if there is less state. This library could be reduced to the 3 items listed above. (Admittedly, my sense of aesthetic and functional style is indeed subjective.)