Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Static exceptions

48 views
Skip to first unread message

woodb...@gmail.com

unread,
Oct 8, 2019, 12:29:30 AM10/8/19
to
Is there a prototype of static exceptions in Gcc or Clang?
Thanks in advance.


Brian
Ebenezer Enterprises - Enjoying programming again.
https://github.com/Ebenezer-group/onwards

Alf P. Steinbach

unread,
Oct 8, 2019, 8:31:48 AM10/8/19
to
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>

- Alf


woodb...@gmail.com

unread,
Oct 13, 2019, 6:32:52 PM10/13/19
to
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.

Anyone want to trade Coroutines and Concepts for static exceptions?


Brian

Öö Tiib

unread,
Oct 14, 2019, 5:56:00 AM10/14/19
to
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.
0 new messages