News for hackers. Stuff that matters.
Re:I Love Ruby by 38 on Tuesday December 19, 2023 @12:50AM (#38692309)
> Go and Rust wisely leave out inheritance for code sharing in their object model

Bad news buddy:

https://gobyexample.com/struct-embedding

At first I loved it, then quickly realized as you did that it makes code essentially unreadable.

Re:I Love Ruby by masklinn on Tuesday December 19, 2023 @01:15AM (#38692455)
That is very much not inheritance. It’s literally just sugar for delegation: calls which delegate to embedded structs execute in the embedded struct’s context.

And the embedded struct has to be part of the struct definition, it can’t be snuck in by reopening the class and include-ing new bits.