DIP 1016 should use expression lowering, not statement lowering
Andrei Alexandrescu
SeeWebsiteForEmail at erdani.com
Tue Jan 29 18:47:01 UTC 2019
On 1/29/19 10:57 AM, Adam D. Ruppe wrote:
> On Tuesday, 29 January 2019 at 15:48:23 UTC, Andrei Alexandrescu wrote:
>> On 1/29/19 10:44 AM, Nicholas Wilson wrote:
>>> if (auto val = expr(); val) { ... },
>>
>> Since we don't have these constructs, lowering would need to explain
>> what happens here.
>
>
> Nitpick, but D has something very similar to that:
>
> if(auto val = expr()) { ... }
>
> it just depends on val implicitly casting to bool.
>
>> It's okay if the resulting code is ugly, it won't be user-visible.
>
> We do have to be careful about this - error messages sometimes leak that
> ugly code out.
Yah, it did happen in the past that implementations have been switched
from lowering to a dedicated case. Lowerings do remain a terrific tool
for conveying semantics and DIP authors should not worry about
implementation details.
More information about the Digitalmars-d-announce
mailing list