uniqueness propagation

Robert Jacques sandford at jhu.edu
Fri Feb 25 20:31:17 PST 2011


On Fri, 25 Feb 2011 22:35:39 -0500, Steven Schveighoffer  
<schveiguy at yahoo.com> wrote:

> On Fri, 25 Feb 2011 19:01:28 -0500, Tomek Sowiński <just at ask.me> wrote:
>
>> Robert Jacques napisał:
>>
>>> On Fri, 25 Feb 2011 02:48:01 -0500, Kevin Bealer
>>> <kevindangerbealer at removedanger.gmail.com> wrote:
>>> > I think immutable could benefit from a Value Range Propagation-like
>>> > uniqueness
>>>
>>> 'unique' has been proposed and heavily discussed before in the news  
>>> group.
>>> There even is std.typecons.Unique. Unfortunately, Walter has stated  
>>> that
>>> there are issues/difficulties in adding 'unique' to the language.
>>
>> What were those difficulties?
>>
>
> YATC (yet another type constructor)
>
> Plus, when this was the topic de jour, there were about 3 other type  
> constructors that were touted as "needed" in order to make unique work  
> (like "borrowed" and "lent").  Bartosz had a blog post about it.  This  
> meant you had to accept 3 or 4 new type constructors to get unique.

My impression was that it was more than that. Yes, also adding a  
'lent/borrowed/scope/no escape' and a 'owned' type would have greatly  
eased and empowered unique, but these were all talked about in the same  
breath back then. Walter indicated that there was something specific to  
unique which was the problem, probably having to do with transitivity.  
Ultimately, 'unique/mobile', 'lent/borrowed/scope/no escape' and 'owned'  
were all about doing shared memory concurrency better, while the flagship  
concurrency model was message-passing.

> I really like this idea as a way to have unique without the type  
> constructor: http://d.puremagic.com/issues/show_bug.cgi?id=5081

Well, that not unique. That's a way to gain one of the major benefits (the  
building of immutable types) of unique without it. That said, I also would  
like it.


More information about the Digitalmars-d mailing list