Errors and the introspection format
dbus at matthew.ath.cx
Sun Feb 19 10:35:14 PST 2006
On Sun, 19 Feb 2006, Havoc Pennington wrote:
> On Sun, 2006-02-19 at 13:45 +0000, Matthew Johnson wrote:
>> On Sun, 19 Feb 2006, Thiago Macieira wrote:
>>> Daniel P. Berrange wrote:
>>>> going along a similar line, if a method does not provide a list of
>>>> exceptions, it doesn't mean that it won't throw exceptions, just that
>>>> it is not providing hints about the exceptions thrown.
>>> Further along that line, would it make sense to have an annotation meaning
>>> "this doesn't throw anything, nor ever will?"
>> aside from the normal 'bus communications failure' and 'unknown service'
>> etc errors.
> And the equivalent of Java's various runtime exceptions - out of memory,
> IllegalArgumentException, assertion failures.
> To put exceptions in the type checking, you need the equivalent of
> unchecked exceptions, and only put the equivalent of checked exceptions
> in the method signature. Yet another reason to just skip this
> complexity. Java programmers can't even get right unchecked vs. checked
> most of the time, let alone all the Python and C++ programmers designing
> dbus APIs.
I just think that the introspection format should contain what
exceptions I should be looking out for. It makes my life easier in both
Java and other languages if they are written down next to the function
definition. An annotation is fine, it doesn't need to be the formal type
of the function, but it should be there.
More information about the dbus