'unwrap envy' and exceptions

Alexandru Ermicioi alexandru.ermicioi at gmail.com
Wed Sep 15 10:47:47 UTC 2021


On Monday, 13 September 2021 at 05:56:18 UTC, Paulo Pinto wrote:
> Java throws statement was based on CLU, Modula-3 and C++, 
> actually.
>
> Herb's idea is based on how Swift does exceptions, and 
> ironically brings exception specifications back into C++, after 
> their removal on C++17, just written in a different form.

Sorry, for confusion, I didn't refer to throws statement in body 
of a method, but rather throws statement in method declaration, 
used to list checked exceptions thrown by the method. I think 
they also can be called an exception specification.

They enforce the caller of method to handle those cases, while in 
C++ spec, the purpose is performance, and unification of error 
reporting format.


More information about the Digitalmars-d mailing list