Struct inheritance

Richard (Rikki) Andrew Cattermole richard at cattermole.co.nz
Fri Sep 20 15:58:37 UTC 2024


On 21/09/2024 3:23 AM, Nick Treleaven wrote:
>     Eliminating the issues with alias this from the design.
> 
>     We can further restrict it, to only support the parent most type in
>     the hierarchy or only one in the hierarchy. In effect it allows
>     adding a new parent to the top of the hierarchy.
> 
> I don't think we need to restrict its capabilities, we just need another 
> syntax for it so we can fix the semantics. If anything I'd like to 
> increase its capabilities. It could be defined as a template method and 
> instantiated with the type of the expected result, and the constraint 
> determines whether the conversion is enabled for that type. In effect, 
> allowing multiple |alias this| with the semantics defined by the 
> aggregate author.

Ok so basically implicit conversions with optional target type.

As long as it is defined as being last resort after looking up through 
the hierarchy, then that aspect I'm ok with. Child most definition only.

You'll need to convince Walter wrt. argument to parameter matching, and 
he has some strong feelings on this.

But as far as the syntax changes are concerned for no target type, I'm 
ok with that being swapped to, it'll give it somewhere to expand to in 
the future.



More information about the dip.ideas mailing list