2 ms·
We can't use composition because we wouldn't get virtual methods. We can't use an interface because then we would be forced into virtual dispatch for all of
by zaphar 12y ago
We can't use composition because we wouldn't get virtual methods.
We can't use an interface because then we would be forced into virtual dispatch for all of those fields that are shared between flows.
we have a heterogeneous tree of objects that all share a common set of fields (position, intrinsic widths, collapsible margins, some various bits that store state during reflow),
You're description seems to me to scream functions: That work on plain structs.
I'm not an expert in performance though so I don't if that is just as bad as the other alternatives you mentioned. But you didn't mention them so I thought I'd ask if you considered that as a valid approach and if so why you rejected them?
- pcwalton 12y agoI don't know what you mean by functions on that work on plain structs; can you elaborate?