RfC for language feature: rvalue struct

FeepingCreature feepingcreature at gmail.com
Mon Jan 30 06:51:16 UTC 2023


On Monday, 30 January 2023 at 03:09:14 UTC, Salih Dincer wrote:
> But `num1 ~= 6` doesn't work because it doesn't have an 
> overload:
>
>> Error: cannot append type `int` to type `S!int`
>
> SDB at 79

But what prevents `num1.field ~= 6`?

Making it private and giving it an accessor.

And then you're at this:

```
struct Struct {
   @ConstRead
   private int[] field_;

   mixin(GenerateAll);
}
```
Which is *exactly* what we're trying to get away from because 
it's too much overhead!

So I appreciate your suggestions, but I hope it's clear that they 
don't compete with

```
rvalue struct Struct {
   int[] field;
}
```


More information about the Digitalmars-d mailing list