Can we just have struct inheritence already?

Manu turkeyman at gmail.com
Tue Jun 11 18:16:46 UTC 2019


On Tue, Jun 11, 2019 at 4:06 AM Walter Bright via Digitalmars-d
<digitalmars-d at puremagic.com> wrote:
>
> On 6/10/2019 5:49 PM, Manu wrote:
> > Well it's an unsatisfying or incomplete definition then if it allows
> > for something so obviously unsafe (in english terms) to be considered
> > perfectly fine.
>
> Memory safety is not an incomplete concept. It's objectively defined.
>
>  > in english terms
>
> We don't use conversational english when discussing mathematics (and this is a
> branch of mathematics) precisely because conversational english is imprecise,
> vague, and people impute their own meanings into it. We cannot have a
> conversation about programming languages unless we have a common understanding
> of what the jargon means.
>
> Here is what memory safety means:
>
> "Memory safety is the state of being protected from various software bugs and
> security vulnerabilities when dealing with memory access, such as buffer
> overflows and dangling pointers."
>
>    -- https://en.wikipedia.org/wiki/Memory_safety
>
> D defines @safe as "memory safe". It does not define it as "no undefined behavior".
>
> D does fall short of that goal, because it doesn't thoroughly track allocated
> memory pointers. But that has nothing to do with undefined values for integers.

You've missed my entire point. I understand memory safety is a thing,
I'm saying I don't care for @safe defined that narrowly. Common sense
would suggest that a "safe" function would alarm you to a blindingly
obvious crash, and I don't care that that crash is specifically a
memory safety violation or not. You can argue semantics, but nobody
that's not a language lawyer who hangs out on forums like this would
expect that.
Low-level mischief (like uninitialised data with manually handled
construction) is plainly not safe, it's low-level hacks and MUST be
treated with absolute care. I should be able to find all instances of
code like that when searching for @system or @trusted, because
probability of mistakes is high.
Anyway, this is off-topic. I also don't tend to use @safe, although I
like the idea in principle.


More information about the Digitalmars-d mailing list