So you are basically saying that

1) The prototype for a value is mutable.
2) You can assign 'primitive' values or ValueComposite's to its attributes
3) A prototype cannot be assigned to an attribute of another prototype

?

I  can buy that!

Not sure if it worth the effort to ensure mutability inside all types of weird 
values in general.
I suspect a more sound approach would be to restrict the possible attribute 
types to ValueComposite's, a few known primitive immutable values, and a few 
known immutable values (such as date and Calendar), which we know and can 
handle.

/Kent

Den 25/06/2012 kl. 07.21 skrev Niclas Hedhman:

> On Mon, Jun 25, 2012 at 1:09 PM, Kent Sølvsten <[email protected]> wrote:
>> I really likeYour idea of constraining mutability in the builder phase to 
>> the value 'in focus' - at least from a framework kind of view.
>> Not sure if it would make usage harder API-wise, though. But it could be a 
>> start allowing better performance with slightly less functionality.
> 
> The more I think about it, the more I like it. We have never assumed
> that one can created nested Value hierarchies from a single
> ValueBuilder anyway, such as
> 
> ValueBuilder<X> vb = module.newValueBuilder( X.class );
> X prototype = vb.prototype();
> prototype.home().get().address().get().street().set("Henan Rd 555");
> 
> should simply not work. I think it doesn't. If it does, then I think
> we simply remove the 'cloning' and require applications to rebuild
> manually.
> 
> 
> There is still a big gaping hole in the Immutability, which is more
> important to fix; We don't "Immute" mutable classes, such as
> java.util.Date, Lists, Maps and so on. Need to worry about that.
> 
> 
> 
> Cheers
> -- 
> Niclas Hedhman, Software Developer
> http://www.qi4j.org - New Energy for Java
> 
> I live here; http://tinyurl.com/3xugrbk
> I work here; http://tinyurl.com/6a2pl4j
> I relax here; http://tinyurl.com/2cgsug
> 
> _______________________________________________
> 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