[Gtk-sharp-list] Gdk.Color, further comments.
Miguel de Icaza
01 Mar 2003 14:04:42 -0500
> > Further comments on Gdk.Color. I do not feel strongly about some of
> > these, but I would like to have a discussion on them:
> > * Gdk.Color.Parse returns an int indicating whether it succeeded
> > or not. Can we map the return value to bool?
> How about having a void return type and throwing an exception if the parse failed?
> I'm not sure if that's any easier to do than returning a bool, but it seems like a better use of the c# language features than having to check the return value.
Throwing exceptions turns out to be very inefficient.
I made this comment to a friend of mine at Microsoft about the fact that
the APIs should be returning an error code and not throwing an exception
in various places where the error is easily catchable, and he agreed
In fact, he said that its part of their new API-design guidelines
apparently. Only use exceptions when you *really* have to.
Exceptions are useful to propagate information to upper layers easily.
And this just does not seem like the kind of error you need to propagate