Hi,

This accidentally went off-list, forwarding for everyone else’s sake.

> Begin forwarded message:
> 
> Date: 30 January 2015 16:01:43 GMT
> Subject: Re: [PHP-DEV] [RFC] Immutable variables and objects
> From: Alexander Lisachenko <lisachenko...@gmail.com>
> To: Andrea Faulds <a...@ajf.me>
> 
> 
> 2015-01-30 18:41 GMT+03:00 Andrea Faulds <a...@ajf.me <mailto:a...@ajf.me>>:
> So what you’re suggesting is a special type of variable modifier which makes 
> that variable have completely different copying semantics to usual?
> 
> That would be quite strange, I don’t see that getting much support.
> 
> 
> 
> Yes, this should affect a variable state and passing an object to the 
> function to make it immutable. But this technique (weakly immutable) is quite 
> useful in several languages. For example, in Java:
> 
> final int j = 42;
> j = 43; // does not compile. j is final so can't be reassigned
> or alternative in C++
> const int j = 42;
> j = 43; // does not compile. j is const so can't be reassigned
> 
> One more example is passing an argument to function as immutable in C++ with 
> "const" and then make a mutable copy of object with const_cast.
> 
Thanks.

--
Andrea Faulds
http://ajf.me/




Reply via email to