"Exceptions will fade away in modern languages"
Meta
jared771 at gmail.com
Wed Nov 25 17:15:14 UTC 2020
On Saturday, 21 November 2020 at 23:05:19 UTC, IGotD- wrote:
> I reacted to the comment of Walter Bright about exceptions in
> the "Destroy All Memory Corruption" presentation. The point he
> made that exceptions don't play well with compile time data
> flow analysis. He also mentioned that he thinks that exception
> will become obsolete in the future. Exceptions are used in many
> languages today and even the newest ones so I can't see a trend
> here.
>
> That raises the question what method is going to replace
> exceptions in that case?
> Will D introduce an alternative method of error handler that
> plays better with @live?
This is well-trodden ground among D's competitors.
Rust has no exceptions (only `panic`, which aborts the current
thread), and instead opts to use algebraic data types along with
some light language support. Swift does something very similar.
Go allows an optional return slot for an Error value that you are
not forced to check, as is typical for Go's approach of choosing
the worst possible option, but at least it's a slight improvement
on C. Get used to writing `if err != nil` every other line.
I think Nim actually does have exceptions.
More information about the Digitalmars-d
mailing list