uniqueness propagation
Steven Schveighoffer
schveiguy at yahoo.com
Fri Feb 25 20:49:51 PST 2011
On Fri, 25 Feb 2011 23:31:17 -0500, Robert Jacques <sandford at jhu.edu>
wrote:
> 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.
Unique has other benefits. You can implicitly cast unique to/from
immutable. You can pass a unique reference via a message without it
having to be immutable.
These would benefit thread-local code, and also 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.
Yes, it is a subset of unique, I should have stated it that way.
-Steve
More information about the Digitalmars-d
mailing list