DConf talk : Exceptions will disappear in the future?
sighoya
sighoya at gmail.com
Thu Jan 7 11:15:26 UTC 2021
On Thursday, 7 January 2021 at 10:36:39 UTC, Jacob Carlborg wrote:
> Swift can throw anything that implements the Error protocol.
> Classes, structs and enums can implement protocols.
>
True, Swift can throw anything what implements the Error
protocol. It seems the error protocol itself doesn't define any
constraints how an error has to look like.
I'm contemplating if this is a good idea, maybe, I don't know yet.
> Some platforms implement C++ exception using longjmp, for
> example, iOS.
Interesting, I've heard some OSes don't support exception tables,
therefore an alternate implementation have to be chosen.
> It's claimed that exceptions are not zero cost, even when an
> exception is not thrown. Because the compiler cannot optimize
> functions that may throw as well as those that cannot throw.
Did you refer to the case a pure function is inlined into the
caller and the machinery of stack pointer decrementation doesn't
work anymore?
You may be right about that. However, I think it can be
transformed safely in case the source code is still available.
In case of dyn libs, we may, can develop a machinery to gather
exception table information at compile time and to manipulate
them in order to inline them safely, but I don't know about the
case in D though.
More information about the Digitalmars-d-learn
mailing list