[Gtk-sharp-list] Using IList for API beauty
23 Apr 2003 20:21:30 -0500
> > I would expect any .NET programmer to know exactly what an IList is
> > > after very little training, but I'd also expect that most would have to
> > > go hunting for docs to find out exactly what a GLib.SList does, (and as
> > > it happens, they wouldn't find any yet).
Responding to thread here... Of course, this would be great. As has
been noticed, some of the work is done already. However, it is much
easier said than done.
The elements of the native list can be of any type. The problem is
determining how to marshal them across to the native side and back. A
possible solution might be to have some internal helper classes like
e.g. ObjectList, which knows how to marshal GLib.Objects (by handle).
Any Methods that return a list containing Objects could instantiate an
ObjectList, marshal the list from the native side, and return an IList.
We could probably accomplish this by tagging <returns> elements in the
xml so we know what IList subclass to use. Passing lists, we probably
would need to have the user instantiate a List subclass that is aware of
how to marshal its contents.
We also have to address ownership of lists. Some of those returned
lists need to be freed.
Anyway, I haven't thought any of this through enough to make sure it
works, or if there are better solutions. If someone wants to draft a
proposal in detail so we can pick it apart on the list, that would be