[bitc-dev] Accurate static typing vs. Dependent Types
Eric Rannaud
eric.rannaud at gmail.com
Sun Dec 7 23:55:07 CST 2008
On Sun, Dec 07, 2008 at 10:37:52PM -0500, Jonathan S. Shapiro wrote:
> The answer is a bit cheesy: BitC does not declare raised exceptions as part
> of a function type. Since *any* function can raise an exception
Why? Why aren't exceptions thrown at least declared with the function?
Why can't we have functions known to not throw exceptions?
There are a number of advantages:
- documentation,
- optimization: if the runtime cost in cycles of being able to catch
exceptions can essentially be zero, there is a significant code size
impact. Embedded code cares about that. Sometimes a *lot*. Knowing
that a particular function doesn't throw any exceptions can help.
- less uncaught exceptions.
There are disadvantages: it can be cumbersome, especially without a way
of saying "f throws ExceptionA and whatever g-called-by-f is throwing",
i.e. polymorphism over exceptions.
Just wondering as I don't remember the subject being discussed here.
Thanks.
More information about the bitc-dev
mailing list