Improvement to struct inheritance possible?
Danilo
codedan at aol.com
Fri Jan 19 06:13:47 UTC 2024
On Thursday, 18 January 2024 at 21:06:22 UTC, Jonathan M Davis
wrote:
> As for typeof, having it do implicit conversions seems like it
> would just be an avenue for bugs.
It's not typeof() that does it, it's the compiler that does it
in the same way it usually does it. See answer to Meta, above.
`alias this = xyz` inside classes and structs:
1. It's useful. And it's allowed to use it like in my first
example, for "importing a struct into the main scope". I
discovered the small issue when writing a constructor generator,
and with this struct it didn't work.
2. It's also about consistency:
In my opinion the (virtual) alias created by `alias this =
xyz`
inside struct/class needs to work everywhere inside the same
class/struct.
That's why asked if it may be a bug. It's at least an issue
if it works only partly.
Seen from a programming language design viewpoint,
I think it should get enhanced a tiny bit to be more
consistent.
More information about the Digitalmars-d
mailing list