The errors aren't really being ignored. Cairo just guarantees it will
not crash if you use a resource that is in an error state. I think this
is much like being able to delete a NULL pointer without having nasty
side effects.<br>
<br>
But I still think using policies would give the user of the wrapper more freedom.<br>
A error-reacting policy wouldn't need to restrict itself to throw an
error or not. It could be custom defined by the user of the wrapper.<br>
We could write different policies that could:<br>
* Very easily define set_ignore_errors(bool) as a mix-in method.<br>
* Completely ignore the errors, so that they would only be checked "manually" at convenient times<br>
* Throw exceptions when an error was detected<br>
<br>
This has the advantage of passing those pesky choices to the wrapper's end-user.<br>
If I don't like to have any kind of run-time overhead in my wrapper, I
would simply select the error-ignoring policy. If I want a choice at
run-time I would use the policy with the mix-in, etc ...<br>
If someday someone decided they needed something different, they could just write a new policy and that would be it.<br>
<br>
I think this gives the user more flexibility and would make Cairomm a very good wrapper.<br>
<br><div><span class="gmail_quote">On 11/24/05, <b class="gmail_sendername">Murray Cumming</b> <<a href="mailto:murrayc@murrayc.com">murrayc@murrayc.com</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>> On 11/24/05, Carl Worth <<a href="mailto:cworth@cworth.org">cworth@cworth.org</a>> wrote:<br>>><br>>> No. C coders are not meant to call _get_status repeatedly. What<br>>> happens is that if _get_status would return an error status then
<br>>> basically all of that object's functions become NOOPs. That is, it is<br>>> still safe to call functions on that object and defer the _get_status<br>>> error checking until a convenient time.<br>>>
<br>>> If binding to a language that supports exceptions it probably does<br>>> make sense to call _get_status after each call and throw exceptions.<br>>><br>>> -Carl<br>>><br>>><br>> I don't know if anyone else agrees with me, but I think the idea of having
<br>> the wrapper be configurable with a policy to handle the errors is highly<br>> attractive.<br>> The alternative would be to have a bool checkForErrors and check if before<br>> checking and handling errors. This would imply run-time overhead, while
<br>> using the policies would not.<br><br>An if(somebool) will not add a significatn amount of run-time overhead.<br>I'd be happy to add a Cairo::set_ignore_errors(bool) function.<br><br>This use of exceptions does seem slightly unusual. If an error can be
<br>ignored, then it does not seem to be an exceptional error.<br><br>Murray Cumming<br><a href="mailto:murrayc@murrayc.com">murrayc@murrayc.com</a><br><a href="http://www.murrayc.com">www.murrayc.com</a><br><a href="http://www.openismus.com">
www.openismus.com</a><br><br></blockquote></div><br>