On 24/04/2009, Ted Dunning <ted.dunn...@gmail.com> wrote:
> With small objects like this, it is generally a very clear win to have
>  immutable objects.
>
>  With larger matrix and vector objects, the advantage is not so clear.  It is
>  often very nice to mutate large matrices in place via views.  This usually
>  happens in the context of a single class such as a decomposition method so a
>  fruitful approach often is to allow a programmer to make a mutable copy that
>  is manipulated for a while destructively and then marked as immutable when
>  it is exposed to the outside world.

How does that work?
Do threads have to get a shared read-lock or exclusive write-lock on the object?

>
>  On Fri, Apr 24, 2009 at 8:09 AM, Eric Bowman <ebow...@boboco.ie> wrote:
>
>  > luc.maison...@free.fr wrote:
>  > > The points above are not theoretical one. Vector3D was mutable and it
>  > > cost us weeks of works at that time to track difficult bugs in a
>
> > > complex application. ...
>
> >
>  > +1
>  >
>  > The cognitive overhead of dealing with the possibility of side effects
>  > is a serious brain drain, particularly on such a fundamental atom.
>  > Embrace immutability, and rejoice.
>  >
>  >
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org

Reply via email to