Does the spec take priority over the compiler?
Steven Schveighoffer
schveiguy at gmail.com
Sun Dec 16 21:32:50 UTC 2018
On 12/16/18 2:42 PM, Neia Neutuladh wrote:
> On Sun, 16 Dec 2018 14:29:04 -0500, Steven Schveighoffer wrote:
>> I would expect the @nogc propagation would require a
>> language change.
>
> A compiler change but not a spec change.
Right.
>
>> Specifically, there's no good way to get the current
>> behavior if you implement the propagation.
>
> Your options:
>
> 1. Move your aggregates above the `@nogc nothrow pure:` line
> 2. Move your aggregates outside the `@nogc nothrow pure {}` block
> 3. Mark functions `@nogc nothrow pure` individually
None of those are good options.
>
>> So you need some way to turn
>> off @nogc in order to make it more encompassing.
>
> That would be quite useful.
Agreed.
>
>> But the fact that the
>> spec says it should propagate probably increases the chances of a change
>> getting accepted.
>
> I'm not terribly confident.
>
Well, I don't know if such a change is possible without fore-mentioned
features to turn off @nogc. So it's one of those things where really I
think the compiler should implement what the spec says, but the reality
is that it would break too much code in a horrible way to make it a reality.
But the spec saying it should be that way gives more weight to the
argument that it should be that way, even if it's painful.
-Steve
More information about the Digitalmars-d
mailing list