> Also, I want to reiterate: Any of these operations MUST be designed to return 
> a new value, never modify in place.  These operators only make sense on value 
> objects, not service objects, and value objects should be immutable.

I completely agree. This was the gist of my earlier comments.

Maybe we should resurrect discussion of the immutable classes and properties 
RFC: https://wiki.php.net/rfc/immutability

If we add the ability to specify immutability, then we can enforce in the 
engine that the left and right operands must be immutable.

For example:

public function __add(immutable $left, immutable $right);

Cheers,
Ben

Attachment: signature.asc
Description: Message signed with OpenPGP

Reply via email to