On Monday, 14 October 2019 01:32:52 UTC+3,
woodb...@gmail.com wrote:
> On Tuesday, October 8, 2019 at 7:31:48 AM UTC-5, Alf P. Steinbach wrote:
> > On 08.10.2019 06:29,
woodb...@gmail.com wrote:
> > > Is there a prototype of static exceptions in Gcc or Clang?
> >
> > Not as far as I know, but if you want to experiment then Boost has a
> > library only thing that provides close to the same functionality.
> >
> > <url:
https://boostorg.github.io/outcome/experimental.html>
> >
>
> I watched Phil Nash's "The Dawn of a New Error" talk at 2019
> CPP Con. It was helpful and I recommend it. He mentions how
> Swift has had static exceptions for years. He also mentions
> Outcome.
Swift's exceptions are useless things in practice. Throwing
these is made less convenient than returning optionals or enums.
Optional in Swift is std::weak_ptr for classes and std::optional
for structs. Enum in Swift is like std::variant.
Apple's framework still throws its Objective C/C++ exceptions
and Swift is incapable of catching those. So a team that wants
to develop in Swift may need to understand all three languages.
Similar issue is with Kotlin and Java ... who wants to develop
in Kotlin may need to understand Java.
> Anyone want to trade Coroutines and Concepts for static exceptions?
If the static exceptions will be made side-by-side with current
exceptions then result will be rather unpleasant.
We had that already with "structured" exceptions. The "__try" and
"try" were in mix on Windows in nineties. That was horrible and
had only bad outcome. RaiseException() is banned by everybody,
lot of people consider exceptions very evil to this day and everything
what was possible to __except with __try is likely doomed to be
"undefined behavior" forever now.