-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Closed
Labels
proposalThis issue suggests modifications. If it also has the "accepted" label then it is planned.This issue suggests modifications. If it also has the "accepted" label then it is planned.
Milestone
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
.
x0d3r, binary132, bjornpagen, valpackett, lerno and 9 morex0d3r, binary132, bjornpagen, victorkamenov, SwayUser and 2 more
Metadata
Metadata
Assignees
Labels
proposalThis issue suggests modifications. If it also has the "accepted" label then it is planned.This issue suggests modifications. If it also has the "accepted" label then it is planned.