Type Inference for Struct/Enum Literals
Richard (Rikki) Andrew Cattermole
richard at cattermole.co.nz
Tue Jul 9 03:57:47 UTC 2024
On 09/07/2024 3:51 PM, IchorDev wrote:
> On Monday, 8 July 2024 at 10:41:39 UTC, Nick Treleaven wrote:
>
> 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.
>
> |MyStruct x; x = _(args); // type identifier not present |
>
> I see what you mean, but |_| is actually an identifier. ;) I know a lot
> of us would like to deprecate it favour of pattern matching
> discards/etc., but it would still be a considerable syntax break. To
> solve the issue you mentioned about there being no identifier, instead
> of having a type for an identifier, we make another similar type that
> stores just a list of parameters.
It is used quite heavily to mean that the variable isn't used for say
foreach statements.
However we will not be diverging from C's identifiers. We are in the
process of bumping the version from C99 to C23.
I can say this on behalf of Walter, due to that bump being something I
had to fight for.
More information about the dip.ideas
mailing list