Type Inference for Struct/Enum Literals
Nick Treleaven
nick at geany.org
Mon Jul 8 10:41:39 UTC 2024
On Monday, 8 July 2024 at 03:26:32 UTC, IchorDev wrote:
> On Sunday, 7 July 2024 at 19:42:25 UTC, Nick Treleaven wrote:
>> However, that doesn't seem to help for an implicit struct
>> construction expression.
>
> I don’t see why a similar solution couldn’t work?
Vladimir's idea is for an identifier to have its own type. When
omitting the struct type, there is no identifier. So that idea
doesn't have a bearing on being able to do that.
```d
MyStruct x;
x = _(args); // type identifier not present
```
BTW it would be nice to be able to omit the class type in a
NewExpression too:
```d
MyClass obj;
obj = new _(args);
```
More information about the dip.ideas
mailing list