Comparing Exceptions and Errors in D

This page summarizes the projects mentioned and recommended in the original post on news.ycombinator.com

InfluxDB - Power Real-Time Data Analytics at Scale
Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.
www.influxdata.com
featured
SaaSHub - Software Alternatives and Reviews
SaaSHub helps you find the best software and product alternatives
www.saashub.com
featured
  • glibc

    Unofficial mirror of sourceware glibc repository. Updated daily. (by bminor)

  • A similar concept is used widely in glibc under the name “__wur” (shorthand for __attribute__((warn_unused_result))).

    https://github.com/bminor/glibc/search?q=__wur&type=

  • druntime

    Discontinued Low level runtime library for the D programming language

  • Oof, seems I got the camelcase wrong. It's `@mustuse`

    Working on updating that.

    I think the reason the documentation is cryptic is because it's a library-supplied User Data Attribute that is specially recognized by the compiler. The documentation generator is having trouble with it. In code it's pretty simple:

    https://github.com/dlang/druntime/blob/705fb36e5fc4d930eed85...

  • InfluxDB

    Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.

    InfluxDB logo
  • FWIW, C++'s noexcept specifier turns exceptions into aborts rather than letting them escape [1]:

    > Non-throwing functions are permitted to call potentially-throwing functions. Whenever an exception is thrown and the search for a handler encounters the outermost block of a non-throwing function, the function std::terminate or std::unexpected (until C++17) is called:

    Microsoft's dialect of C++ has a nothrow attribute which is purely advisory, like D's, and is now deprecated in favour of noexcept [2]:

    > We recommend that all new code use the noexcept operator rather than __declspec(nothrow).

    > This attribute tells the compiler that the declared function and the functions it calls never throw an exception. However, it does not enforce the directive. In other words, it never causes std::terminate to be invoked, unlike noexcept, or in std:c++17 mode (Visual Studio 2017 version 15.5 and later), throw().

    Rust has panics, which by default unwind, like exceptions, but can be compiled to abort instead [3]:

    > By default, when a panic occurs, the program starts unwinding, which means Rust walks back up the stack and cleans up the data from each function it encounters. However, this walking back and cleanup is a lot of work. Rust, therefore, allows you to choose the alternative of immediately aborting, which ends the program without cleaning up.

    I don't believe there is any stable or planned way to declare that normal Rust functions cannot panic (so should abort instead of letting the panic escape). But there is some work towards the idea that extern "C" functions should do so [4].

    [1] https://en.cppreference.com/w/cpp/language/noexcept_spec

    [2] https://docs.microsoft.com/en-us/cpp/cpp/nothrow-cpp?view=ms...

    [3] https://doc.rust-lang.org/book/ch09-01-unrecoverable-errors-...

    [4] https://github.com/rust-lang/project-ffi-unwind/blob/master/...

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts