-preview=in might break code

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Sat Oct 3 05:02:36 UTC 2020


On 10/2/20 6:11 PM, Walter Bright wrote:
> On 10/2/2020 10:31 AM, Steven Schveighoffer wrote:
>> And this might not be true on a different compiler.
> 
> This is looking like a serious problem.

They say one should choose one's fights wisely, so I spent some time
pondering. I could just let this thread scroll by and not think twice
about it. By next week, I may as well forget.

But then I realized this is /exactly/ the kind of crap that we'll all
scratch our heads six months from now, "How did this ever pass review?
Who approved this? How in the world did a group of competent,
well-intended people, looked at this and said - yep, good idea. Let's."

???

This glib take is EXTREMELY concerning:

> In the general case, no. You can have two distinct pointers with the
> same value, and there's nothing the frontend can do to detect it.
> 
> This scenario has been brought up during the review. I doubt it will,
> in practice, be an issue though. This is not a common pattern, nor
> does it seems useful. It rather looks like a code smell.

Wait a SECOND! Are we really in the market of developing and deploying 
language features that come unglued at the slightest and subtlest 
misuse? We most certainly shouldn't.

I sincerely congratulated Mathias and the other participants for working 
on this. It's an important topic. Knowing that all those involved are 
very good at what they do, and without having looked closely, I was sure 
they got something really nice going that avoids this absolutely blatant 
semantic grenade. And now I see this is exactly it - we got a -preview 
of a grenade. How is this possible? How can we sleep at night now?

Again: take a step back and reconsider, why did this pass muster?

This is important, folks. It's really important as parameter passing 
goes to the core of what the virtual machine does. You can't say, meh, 
let's just fudge it here, and whatever is surprising it's on the user.

Please, we really need to put back the toothpaste in the tube here. I 
could on everybody's clear head here to reconsider this.


More information about the Digitalmars-d mailing list