Unique as a transitive type?

Sean Kelly sean at invisibleduck.org
Mon Jun 1 20:33:57 PDT 2009


Jason House wrote:
> Sean Kelly Wrote:
> 
>> Jason House wrote:
>>> Andrei has stated previously that unique was left out of the type system because it added little value to the const system. Now that shared and multithreading are here, unique has more value.
>>>
>>> I have two basic questions:
>>>
>>> 1. What would make unique difficult to add?
>> Move semantics.  Just passing a unique value type to a function, a copy 
>> is performed.
> 
> Why would copying occur? Can't a function simply pass it by reference and then zero out that register when done?

Technically, yes.  I meant more from a language standpoint.  A copy 
theoretically occurs when returning a value from a function as well.



More information about the Digitalmars-d mailing list