Thank you!
Basile B.
b2.temp at gmx.com
Tue Sep 7 08:46:48 UTC 2021
On Tuesday, 7 September 2021 at 05:01:30 UTC, Tejas wrote:
> On Tuesday, 7 September 2021 at 01:34:01 UTC, Basile B. wrote:
>> On Wednesday, 1 September 2021 at 04:40:37 UTC, Виталий Фадеев
>> wrote:
>>> I want say "Thank you!" to all who works under D.
>>>
>>> I see the result of your work, even if it is small, even the
>>> size of a byte.
>>> I use D and see your gift.
>>> I like. :)
>>
>> while this code looks natural and obvious, although pointless
>>
>> ```d
>> module m;
>>
>> struct S { int i; }
>>
>> S _s;
>>
>> S s (){return _s;}
>>
>> void main()
>> {
>> s().i = 42;
>> }
>> ```
>>
>> the reality is that `i` can only be accessed through a pointer
>> to a `S` (you want a deref of the address plus a offset).but
>> `s` returns a `S` by value... so a temporary is created.
>>
>> All the time we write code that compiles but this code just
>> compiles because the front end will help us, in this case, by
>> turning `s()` into a lvalue.
>>
>> so we can indeed say thanks. what you think just works
>> actually requires some unexpected rewrites, like **all the
>> time**.
>
> Don't you think it would be better to raise a warning though
> instead of silently fixing it?
no. as compiler experiment people can add a flag to generated
temproaries and then printf on a visitor for VarExp and then will
probabably be surprised by the amount of message printf'd like
2567 times
"look boy am saving expressivity for ya here"
>
> It would help people understand the differences between [...]
More information about the Digitalmars-d
mailing list