On Saturday, 6 December 2014 at 12:38:24 UTC, Ola Fosheim Grøstad wrote:
On Saturday, 6 December 2014 at 04:31:48 UTC, Sebastiaan Koppe wrote:
What about also adding the inverse of scope? Then scope can be inferred. As in:

```
void foo(int* p);
void free(P)(consume P* p);


Yes, this is much better. When I suggested it, it was rejected because D is too concerned about breaking existing code. Which is a not-very-good argument since this breaking change is concervative (you only have to add "consume" or something similar when the compiler complains).
Hmm, I see.

Whenever I suggest to break something at my job - which, admittedly is much easier there than in a language - I get faced with some serious reluctance. My argument is always the same: It is going to make you happy, eventually.

How would it break anything though? Wouldn't functions eligible for `consume` already have the programmer ensuring the arguments haven't escaped before/after the function call? In case they did a bad job - sure it would break - but it would have been a bug.

The obvious solution is to do as you suggest and in addition do all @safe analysis on a high level IR layer using dataflow through and through.
I am a big proponent of dataflow analyses, but I got the feeling people think is it pretty hard. Couldn't find much detailed papers on it, so I don't know.

Reply via email to