Re:Plain C API design, the real world Kobayashi Maru test
by dromtrund on Sunday April 16, 2023 @04:16PM
(#35593877)
+1, this approach will also highlight cases where you're trying to generalize something that isn't as generic as you thought.
I'd argue that the need for downcasting in a method working on the inner context would also be a code smell, and that you might want to reconsider the context split. In some cases, there's no way around it (like async events), but it might be more appropriate to pass additional context or a callback instead, to avoid a circular dependency.
I'd argue that the need for downcasting in a method working on the inner context would also be a code smell, and that you might want to reconsider the context split. In some cases, there's no way around it (like async events), but it might be more appropriate to pass additional context or a callback instead, to avoid a circular dependency.