Vision for the D language - stabilizing complexity?

Shachar Shemesh via Digitalmars-d digitalmars-d at puremagic.com
Mon Jul 11 22:15:09 PDT 2016


On 08/07/16 22:26, Andrei Alexandrescu wrote:

> I agree with that. What would be a good example? Where is the reference
> to Walter's promotion of UB in @safe code?
>
>
> Andrei

I don't have an example by Walter, but I can give you an example by Andrei.

In D-Conf.

On Stage.

During the keynotes.

Immediately after knocking down C++ for doing the precise same thing, 
but in a that is both defined and less likely to produce errors.


The topic was reference counting's interaction with immutable (see 
deadalnix's comment, to which I completely agree, about inter-features 
interactions). When asked (by me) how you intend to actually solve this, 
you said that since you know where the memory comes from, you will cast 
away the immutability.

Casting away immutability is UB in D.

Not long before that, you laughed at C++ for it's "mutable" keyword, 
which allows doing this very thing in a way that is:
A. Fully defined (if you know what you're doing)
and
B. Not requiring a cast


C++ fully defines when it is okay to cast away constness, gives you aids 
so that you know that that's what you are doing, and nothing else, and 
gives you a method by which you can do it without a cast if the 
circumstances support it.

D says any such cast is UB.

Shachar


More information about the Digitalmars-d mailing list