type of concatenated arrays

David B. Held dheld at codelogicconsulting.com
Fri Nov 9 01:58:31 PST 2007


Reiner Pope wrote:
> [...]
> This problem keeps occurring, because we have no way within the language 
> te express the property, "this array is unique" -- which would mean it 
> can be used as invariant or mutable as you desire. A number of people 
> have suggested a unique type qualifier at different times, although I'm 
> not sure if anyone has defined a semantics for unique types, so that 
> they are guaranteed to be unique.

There are some rather thorough papers on 'unique', and it's been 
discussed by Walter's posse, but the general conclusion is that infects 
the type system in a way that is rather intrusive for the amount of 
benefit gained.  I happen to think it's an elegant concept, but I have 
to admit that it might be too elegant to be useful.

One problem with unique is that it's not really a closed system.  It's 
highly entropic.  What I mean by that is that there's lots of ways to go 
from a unique reference to a non-unique one, but no sound way to do the 
reverse (technically, collected memory could be soundly declared as 
'unique', but manually allocated memory is problematic at best).

Dave



More information about the Digitalmars-d mailing list