On Sun, 12 Sep 2010 09:35:42 -0400, Sönke Ludwig <[email protected]> wrote:
9. unique

Unique objects or chunks of data are really important not only to be able to check that a cast to 'immutable' is correct, but also to allow for passing objects to another thread for computations without making a superfluous copy or doing superfluous computation.

Unique (or for those with an Occam background 'mobile') has several proponents in the D community (myself included). It was seriously considered for inclusion in the type system, but Walter found several issues with it on a practical level. If I recall correctly, Walter's exact issues weren't made public, but probably stem from the fact that unique/mobile types in other languages are generally library defined and are 'shallow'. They exist as a 'please use responsibly' / 'here be dragons' feature. For unique to be safe, it needs to be transitive, but this severely limits the objects that can be represented. For example, a doubly-linked-list can not be unique. Unique has been integrated into the Clean and Mercury functional languages (or so says Wikipedia), so there might be reasonable solutions to these problems.

Reply via email to