On Thu, Aug 21, 2008 at 2:03 AM, Raoul Duke <[EMAIL PROTECTED]> wrote:
> for somebody out there who might have the time & smarts in other words
> not simple me, porting Qi to http://clojure.org/ might be neat; you'd
> end up with quite an interesting layered mix of technologies :-)

This dog has been around long enough to have done some LISP-like
syntaxes in the past... For me; Never Again!

That said; There are many things I like about the Rationale and
principles behind Clojure, especially the "Functional Programming" and
"Entity Identity references a Value". Enough so, that I think it is
worth-while considering an "alternate mode" in Qi4j where mutability
is disabled. What? Yes, I think we actually have most of the building
blocks to make this possible at Composite level;

In this alternate mode;

*  TransientComposites would not be allowed.

>From that follows; All mutable objects must be Entities. Entities have
Identities that references a State and State is effectively a single
Value, an all-or-nothing change protected in the UnitOfWork. Indeed
very similar to what is described in Conjure's "Identity and State"
page, http://clojure.org/state.

* All fields in ServiceComposites must be 'final'.

>From that follows that no synchronization would be needed for
ServiceComposites. If ServiceComposites need mutable state, it should
reference an Entity.

* A effective "clone" mechanism on ValueComposites.

For instance, the CompositeBuilder could have a "clone" method, where
an existing instance of the same type is passed, and the builder state
will set up from such state, and the the client code just modifies the
properties it needs to change, and newInstance() spit out the "clone".
IMHO, this might make sense in the current Qi4j as well.


 * (Possibly other things.)

Point is, if we add the "clone()" to CompositeBuilder, then all of the
above can be runtime "switchable", and possibly improve code
robustness for those that want that over pure speed (mutable
TransientComposites are faster than MemoryEntityStore backed
Entities).


WDYT?


Cheers
Niclas

_______________________________________________
qi4j-dev mailing list
[email protected]
http://lists.ops4j.org/mailman/listinfo/qi4j-dev

Reply via email to