[Gtk-sharp-list] Gdk.Color, further comments.
Miguel de Icaza
miguel@ximian.com
04 Mar 2003 10:47:51 -0500
Hello,
> > OK, now what about the implementation of the System.IO.Stream class,
> > using GnomeVFS. For example, consider the implementation of the
> > "Close" method:
> ..snip..
> > As you can see, there is no way to "return" the error. So, currently,
> > I just throw it. I could take an alternate approach. (I could have
> > something like a "errno" in the class, and do stuff like this.)
>
> > What do you think? Should I take this approach? Should I take
> > another approach? Or what?
>
> Personally I prefer the approach you have that throws when things have gone wrong.
> If an API user doesn't do any error checking at all, then throwing will alert them when something goes wrong. Whereas an unchecked errno remains forever silent until the program crashes as a result of the failure, but in a subtle way some time later...
It is definitely possible to do this, but again, exceptions are
miss-used, and you pay a very high price for common file-system
operations like probing. Again, this is one of the reasons why they are
trying to get rid of them.
Miguel