So these two compile and, in non-debug builds, run just fine
Era Scarecrow via Digitalmars-d
digitalmars-d at puremagic.com
Sat Nov 26 05:42:11 PST 2016
On Friday, 25 November 2016 at 15:30:35 UTC, Steven Schveighoffer
wrote:
> But I think Walter's scope changes (DIP 1001 I think?) will
> make it so the compiler rejects this even in non-safe mode.
Rejecting it would be nice...
Although I wonder... I've been wondering and thinking about if
we could add extra metadata to non-release code for the purpose
of debugging. The idea being every variable will have an attached
hidden metadata tag/field (let's assume 32bits). This can then
flag the information in various ways. For memory allocation we
have stack/GC/static/other, then we have if this was passed back
from a function, was modified. Basic type information could
specify what the general type origin was (when first
allocated/first assigned), was a slice of large data, originally
was const, or immutable, shared, a pointer that's been tampered
with (say using bits for extra data vs an actual pointer), and
anything else we wanted to potentially track.
While this information isn't useful on the surface, hidden
checks could be thrown out there, like returning a variable from
the local stack when it might otherwise be obfuscated and hidden.
More information about the Digitalmars-d
mailing list