Discussion Thread: DIP 1035-- at system Variables--Community Review Round 2

Dennis dkorpel at gmail.com
Wed Mar 3 10:05:34 UTC 2021


On Tuesday, 2 March 2021 at 15:34:31 UTC, Dukc wrote:
> How is this piece from the rationale section describing the 
> situation before DIP1035?
>
> "Since the initialization expression cast(int*) 0xDEADBEEF 
> would not be allowed in a @safe function, and since the initial 
> value of y is unknown, the compiler should annotate variables x 
> and y as possibly containing an unsafe value, so they cannot be 
> accessed in a @safe function. Only z is known to have a safe 
> initial value in this case, so the compiler could allow access 
> to it in @safe code."

I don't understand the question. Is there a contradiction in that 
paragraph I'm supposed to see? Note that the description is about 
what the compiler _should_ do given the current language 
semantics, not what dmd actually does. The version of the DIP 
from the previous review round acknowledged existing holes in 
@safe and was critiqued for it, so this version tries to use the 
language specification as a base rather than the implementation. 
(Though that's not always easy, since the specification is 
lacking in certain areas as well)



More information about the Digitalmars-d mailing list