Implicit conversion of unique objects to mutable and immutable

Ali Çehreli acehreli at yahoo.com
Wed Jun 22 10:47:01 PDT 2011


On Wed, 22 Jun 2011 15:58:02 +0000, Timon Gehr wrote:

> On Wed, 22 Jun 2011 00:02:55 +0000, Ali Çehreli wrote:
> 
>> I wonder whether a UniqueRef object could be returned, which could
>> allow a single casting of its data to mutable or immutable at the call
>> site. Further casts could throw, but that would be a runtime solution.
>> :-/
> 
> Further casts should return null.

I thought about that too but if null is a valid value itself and if the 
value should be casted only once, throwing seemed a better choice.

> Timon

Ali


More information about the Digitalmars-d-learn mailing list