On 5/13/13 3:06 AM, deadalnix wrote:
On Sunday, 12 May 2013 at 20:28:56 UTC, Walter Bright wrote:
On 5/12/2013 6:01 AM, Andrei Alexandrescu wrote:
Bartosz, Walter and I reached a similar design a few years ago. We
just thought
it complicates things too much for what it does.

I've been working in the background on a scheme that can infer
uniqueness. The beauty of it is it will not require visible language
changes - it's just that things that didn't compile before now will.
It won't solve all the problems, but I'm hoping it'll solve enough
that the rest will not be more than a minor annoyance.

For a trivial example,

shared p = new int;

would work, as 'new int' would be inferred to be unique, and a unique
pointer can be implicitly cast to immutable or shared. This plays to
D's strength with function purity, transitive const/immutable/shared,
attribute inference, etc.

It smell like an ad hoc solution that will be completely undefined.

To me it sounds like anything but. Walter explained the idea to me and it's definitely worth exploring. We will work together on a DIP.

Andrei

Reply via email to