Hi!

> Because of for immutable objects it's not allowed to set an mutable
> object as property
> you can be sure the object's state will be consistent. That's the main

It may be harder to achieve than you think. How exactly do you ensure
they property values do not end up containing mutable values?
I.e. something like this in the ctor:

$a =& $this->foo;
$a = bar();

How do you ensure $this->foo does not have mutable value in it now?
Also, would that mean that you can not call any function that accepts
values by-ref with anything derived from $this? It may be not easy to do.

Also, I'm not sure how practical it is. I.e., immutability is very
imporant in some applications like parallel processing and also for some
languages where some performance optimizations rely very hard on certain
constructs being immutable, but in PHP there are no such things, so
except for documentation, what would be the added value here?
-- 
Stas Malyshev
smalys...@gmail.com

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to