DIP 1021--Argument Ownership and Function Calls--Community Review Round 1

Walter Bright newshound2 at digitalmars.com
Wed Jul 17 23:26:20 UTC 2019


On 7/17/2019 11:59 AM, Olivier FAURE wrote:
> The current example isn't good enough. It's not @safe (it calls free() 
> directly), it's not RAII (the structure doesn't manage its own memory),

That's not the point. A container with an @safe interface can do this, for 
example, simply by appending to the container contents the pointer to the old 
contents can be invalidated. The point of the example is to illustrate the 
problem clearly, not obfuscate it with the complexities of a container object.

More generally, any time there are two mutable pointers to the same memory 
object, one can invalidate the other. This is the principle pointed out in the 
"Prior Work" section. The DIP is not intended to be a tutorial on this, which is 
why there's a link to more explanation. It has nothing to do with RAII, and 
thinking about it in terms of RAII will miss the generality of the concept.


> and it doesn't even show what a syntax error would look like.

A language specification does not specify the text of error messages, merely 
that a particular configuration is not legal.


 > The proposal says inter-statement checking isn't done, but it doesn't explain 
what is or isn't inter-statement checking. Do nested expressions count?

The current language spec makes it clear what a statement is and what an 
expression is.


More information about the Digitalmars-d mailing list