You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
people may suddenly use wrong type or field for the fieldParentPtr since a struct can have more than one node embeded (for different containers), and different struct can have node field (it is actually happens to me), so the type safe version can help people to defense those error..
The text was updated successfully, but these errors were encountered:
codehz
changed the title
Proposal: make std.rb more type safety
Proposal: make std.rb more type safe
Sep 7, 2020
(since zig has fn to generate type, we can enforce the type for the node, insteads of manually
@fieldParentPtr
in userland.)I'm not mean to use something like
fn Node(comptime key: type, comptime value: type) type
, it is a good embed container design.proposal version:
(the naming is not matter, focus the idea)
(also change the Tree definition to accept the Node)
and the userland struct for node:
people may suddenly use wrong type or field for the fieldParentPtr since a struct can have more than one
node
embeded (for different containers), and different struct can have node field (it is actually happens to me), so the type safe version can help people to defense those error..The text was updated successfully, but these errors were encountered: