3 ms·
3) and 4) are essentially subclasses of 1) and to solve 1) one needs a typesystem like in Koka or PureScript where code is polymorphic regarding effects so intr
by fpoling 10y ago
3) and 4) are essentially subclasses of 1) and to solve 1) one needs a typesystem like in Koka or PureScript where code is polymorphic regarding effects so introducing new one without breaking existing code is possible. PureScript uses that to precisely model JS exceptions.
As for 2) the exceptions are not zero-costs even with modern implementations and profile-driven optimizing compiler makes the runtime cost of wrapping/unwrapping low.
- Rexxar 10y agoC++ exception can be "zero cost" in the non exceptional path (for example http://llvm.org/docs/ExceptionHandling.html#itanium-abi-zero-cost-exception-handling http://llvm.org/docs/ExceptionHandling.html#itanium-abi-zero...)
- fpoling 10y agoPresence of exceptions still prevents some optimizations that the compiler can do otherwise like omitting frame pointer etc.