You cannot make a "generic merge" with only the information which fields
have been written. You also need to know which fields were read in order to
derive the written values. In Qi4J this list of read fields should be easy
to create.

A UoWs (transaction) can be committed when all the read fields still have
the same values as when the UoW started. The old values of written, but not
read, fields are irrelevant since they are blindly overwritten.

Essentially the idea is that when all the read fields still have the same
value, the UoW would have exactly the same result if repeated right now.
This of course assumes that that code is deterministic and not dependent on
IO or the wall clock or something like that.


cheers, Guus


On Tue, Apr 7, 2009 at 5:49 AM, Stuart McCulloch <[email protected]> wrote:

> 2009/4/7 Niclas Hedhman <[email protected]>
>
>> On Tue, Apr 7, 2009 at 2:05 AM, Raoul Duke <[email protected]> wrote:
>> > i'm wondering how close this will get to functional programming with
>> > stm, like Haskell :-)
>>
>> I don't know Haskell in particular, but a pure functional programming
>> language can not have sideeffects at all, which at its extreme
>> wouldn't even allow output to System.out and even less so to a
>> persistence system. How this is handled in reality, I don't know and
>> can't comment on with what is similar or different.
>>
>
> FYI, they use "monads" to express changes in state:
>
>   http://en.wikipedia.org/wiki/Monads_in_functional_programming
>
> Cheers
>> --
>> Niclas Hedhman, Software Developer
>> http://www.qi4j.org - New Energy for Java
>>
>> I  live here; http://tinyurl.com/2qq9er
>> I  work here; http://tinyurl.com/2ymelc
>> I relax here; http://tinyurl.com/2cgsug
>>
>> _______________________________________________
>> qi4j-dev mailing list
>> [email protected]
>> http://lists.ops4j.org/mailman/listinfo/qi4j-dev
>>
>
>
>
> --
> Cheers, Stuart
>
> _______________________________________________
> qi4j-dev mailing list
> [email protected]
> http://lists.ops4j.org/mailman/listinfo/qi4j-dev
>
>
_______________________________________________
qi4j-dev mailing list
[email protected]
http://lists.ops4j.org/mailman/listinfo/qi4j-dev

Reply via email to