Both safe and wrong?
Luís Marques
luis at luismarques.eu
Mon Feb 4 00:53:44 UTC 2019
On Monday, 4 February 2019 at 00:35:43 UTC, Rubn wrote:
> It's kind of ironic that you can't have @safe code that's not
> in a function. Kind of seems like a gigantic hole in creating a
> safe language.
Right. As CTFE illustrates, a variable's initialization
expression is a kind of compile-time code. See the fine line
between constant folding and CTFE, etc. So, not being inside a
function declaration is not a particularly useful distinction,
from the user's point of view. In fact, that's what I was
thinking about when I started this thread: some possible changes
to the way that expressions are typed, and how that interacts
with @safe.
More information about the Digitalmars-d
mailing list