On Tuesday, 24 February 2015 at 20:53:24 UTC, Walter Bright wrote:
On 2/24/2015 10:00 AM, Andrei Alexandrescu wrote:
I also owe you apologies for not acknowledging that work. I
find the proposal
too complicated for what it provides and that's the short and
long of it. It's
easy to make a large and complex language addition to support
any sensible
abstraction. That doesn't make it automatically good.
My criticisms of it centered around:
1. confusion about whether it was a storage class or a type
qualifier.
2. I agree with Andrei that any annotation system can be made
to work - but this one (as are most annotation systems) also
struck me as wordy, tedious, and aesthetically unappealing. I
just can't see myself throwing it up on a slide and trying to
sell it to the audience as cool.
3. In line with (2), I want a system that relies much more on
inference. We've made good progress with the existing
annotations being inferred.
4. I didn't see how one could, for example, have an array of
pointers:
int*[] pointers;
and then fill that array with pointers of varying ownership
annotations.
5. The (4) homogeneity requirement would mean that templated
types would get new instantiations every time they are used
with a different ownership. This could lead to massive code
bloat.
6. The 'return ref' scheme, which you have expressed distaste
for, was one that required the fewest instances of the user
having to add an annotation. It turned out that upgrading
Phobos to this required only a handful of annotations.
7. 'return ref' makes memory safe ref counted types possible,
finally, in D, without needing to upend the language or legacy
code. And as the example I posted showed, they are
straightforward to write. Only time and experience will tell if
this will be successful, but it looks promising and I hope
you'll be willing to give it a chance.
Thanks for summarizing your reasons. I knew that you were unhappy
with 1 - 3); I wasn't aware of 4) and 5). I can't get into detail
now, as it's already late at night here, but I'll try thinking
about it tomorrow.
FWIW, Zach just wrote in another thread that he will have his own
proposal ready soon, based on DIP25, with `scope` being a storage
class. Let's see how this goes.