const challenge

Janice Caron caron800 at googlemail.com
Thu Jan 31 14:23:19 PST 2008


On 1/31/08, Georg Wrede <georg at nospam.org> wrote:
> Unique sounds interesting. And new to me, at least as a definable concept.
>
> Question: suppose you have something defined as unique, and then
> somebody makes a copy of it. What happens to the uniqueness?
>
> (You may want to explain this even more broadly if you know that most
> people have had problems getting some specific part of the idea.)

Coincidentally, Andrei posted about this very thing just today.

http://www.digitalmars.com/webnews/newsgroups.php?art_group=digitalmars.D.bugs&article_id=13195

He wrote Unique!(T) where I wrote unique(T).

Uniqueness isn't something the compiler can check, so the idea is to
make it the user's responsibility. Simply put, unique(T) can
implicitly cast to T, const(T) or invariant(T). But woe betide any
irresponsible programmer who declares something unique when it isn't!



More information about the Digitalmars-d mailing list