On Sunday 01 November 2009, Øyvind Harboe wrote:
> > If by "waiting" you mean "want to see patches", I'll send
> > a larger preview at some point.  But container_of() seems
> > already, as Nico noted, sufficient to current tasks... and
> > just simplifying (like above) will be a major win.
> 
> I'd like to see an interface scheme that allows for optional
> interfaces, down and upcasting(which can fail) &
> polymorphism. I won't try to give examples of where we'll
> need those standard mechanisms, but I'm sure we will
> before it's all said and done.

Maybe we'll need them, maybe not ... I've worked with quite
a few systems more complex than a JTAG debugger that don't
need them!  (Apple's Objective-C stuff is an interesting
argument in that direction too...)  Regardless, first step
should be making the current stuff simpler and safer.

At any rate, upcasting is trivial (return &p->foo_struct)
given the current single inheritance, and can't fail.  It's
the downcasting which could fail:  converting from generic
type to a more specific one.

Today's approach prevents that in one way: most methods
are only accessible through method tables of properly
initialized objects.

The annoying case is when code needs to guard against
errors in cases like "command issued to current target",
where it can fail ... because the commands are global,
instead of being coupled to a current interpreter which
only includes commands that target can support.

- Dave

_______________________________________________
Openocd-development mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/openocd-development

Reply via email to