Closed
Description
GCC allows use of -fplan9-extensions
to accomplish Go-style anonymous struct embedding. See more here. I believe this is a simple C concept (seeing as it was a Plan 9 C compiler extension), so does not conflict with the C-style simplicity of Zig, and adds some nice abstractions to structs for free. The main benefit: extending a struct is by and large unnecessary when the compiler let's you treat the parent struct like it was an instance of the embedded base class (Liskov substitution principle applies to parent structs).
One quick example, stdout
often needs to be replaced with stdout.stream
despite the fact the stdout
is meant to implement a stream. This could simplify all uses of stdout.stream
back to stdout
.