RfC for language feature: rvalue struct

FeepingCreature feepingcreature at gmail.com
Thu Jan 26 03:39:14 UTC 2023


On Wednesday, 25 January 2023 at 23:56:20 UTC, TheZipCreator 
wrote:
> I mean, couldn't you just do this?
>
> ```d
> struct Foo {
> immutable:
> 	int bar;
> 	int[] baz;
> }
> ```
>
> Unless I'm missing something, I don't really see why an 
> entirely new language construct is required.

The problem is that then you can't do

```
Foo foo;
foo = Foo(2, [3]);
```

And that may look easy to avoid, but there's a plethora of bugs 
where for instance Phobos does just that.


More information about the Digitalmars-d mailing list