-preview=in might break code
Andrei Alexandrescu
SeeWebsiteForEmail at erdani.org
Mon Oct 5 02:46:42 UTC 2020
On 10/4/20 10:19 AM, Iain Buclaw wrote:
> On Saturday, 3 October 2020 at 05:02:36 UTC, Andrei Alexandrescu wrote:
>> 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?
>
> I take offense to that. I'd prefer if you'd moderate your tone please.
Of course. Please accept my apologies.
>> 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."
>>
>> ???
>>
>
> *You* approved it.
>
> https://github.com/dlang/dmd/pull/11000#issuecomment-675605193
Oi. Touché.
>> Please, we really need to put back the toothpaste in the tube here. I
>> could on everybody's clear head here to reconsider this.
>
> Frankly, I think you are making a mountain out of a molehill here. You
> are imagining a problem that doesn't exist; and if one does find an
> issue, the fault lies with the DMD compiler and not the D language
> specification. Though evidently having clearer wording in the spec
> benefits all.
I think my STL examples have put the narrative that confusing aliasing
is rare to rest.
> If you read nothing more of this reply, at least finish up until the end
> of this paragraph. Please hold fire until GDC and LDC have implemented
> this feature, then we can discuss the pitfalls that we've encountered
> with it. Basing decisions on behaviors observed with DMD is not the
> right approach, and if you are currently finding the situation to be a
> mess, it is a mess of DMD's own doing.
Implementation details of dmd are not of concern here, and in fact the
more different ldc/gdc/dmd are from one another, the more problematic
the entire matter is.
> 2. Aliasing was raised multiple times throughout the review, I even gave
> this example at time to demonstrate my concerns:
> ```
> void bar(in int a, out int b) { }
> int a = 42;
> bar(a, a);
> ```
> But ultimately, worrying about this is missing the point, as the problem
> is already present in the compiler even without `-preview=in`, and
> Walter is working on fixing it. In the meantime, these sorts of cases
> are relatively trivial to pick up and can be added as warnings in GDC
> and LDC until the front-end implements the semantic guarantees.
That's nice. If the "in" feature is paired appropriately with some sort
of verification, my concerns are entirely allayed. "Entirely" of course
if the problem is resolved entirely as well. Thanks.
More information about the Digitalmars-d
mailing list