Thank you!

Basile B. b2.temp at gmx.com
Tue Sep 7 01:34:01 UTC 2021


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**.


More information about the Digitalmars-d mailing list