Editions Ideas
6622
notanemail at foo.fake
Tue Dec 23 00:29:22 UTC 2025
On Tuesday, 16 December 2025 at 21:08:39 UTC, Richard (Rikki)
Andrew Cattermole wrote:
> Yeah absolutely.
>
> But there will be some behavior that won't be replicated wrt.
> overriding, and that is an intentional breakage.
>
> For instance I don't want fields supported, just a single
> method.
> You don't need fields supported.
>
> ```d
> T field;
>
> ref T opDispatch(string op : "") => field;
> ```
>
> Longer sure, (and yes there are opinions about a different
> signature), but it'll optimize out and keeps it being a simpler
> feature.
>
> I'm sure once discussed it'll change, I would be surprised if
> it survives a meeting for what I came up with.
I use alias this on my structs a lot.
Its ideas like this that make me worry about editions regressing
the language. Editions should be used for cleaning up the
language, fixing up problematic semantics and ugly corners. This
is very ugly and verbose compared to the current alias this
syntax. Dont make D more C++ or Rust like :^)
I support removing the multiple inheritance, it snuck into the
language unintentionally. I also hope to see the graceful
automatic type casting into the base type stay, its useful.
If the syntax is to be changed, I liked the idea of it reusing
the class inheretence syntax but for structs `struct Foo :
BaseType {}`. Whatever the new syntax is, it needs to be good on
the eyes! I have hundreds of simple structs that use alias this
to create wrapper types, its useful for protecting from the wrong
arguments being passed to functions & etc...
More information about the Digitalmars-d
mailing list