Why is there no throws, @gc, impure, mutable ?

Paul Backus snarwin at gmail.com
Mon Sep 7 11:44:40 UTC 2020

On Monday, 7 September 2020 at 11:25:15 UTC, wjoe wrote:
> It's easy to declare the entire module @safe and functions 
> which can't be can be declared @system.
> However there is const, immutable, pure, @nogc and nothrow but 
> no mutable, impure, @gc and throws.
> Why is that ?

Mostly because nobody's bothered to add them (yet). There's an 
accepted proposal to add a "throw" attribute as the opposite of 
nothrow [1], but it looks like it still hasn't been implemented 
in the compiler.

For const and immutable, you can use std.traits.Unconst [2] to 
remove them in most cases.

[2] http://dpldocs.info/experimental-docs/std.traits.Unconst.html

More information about the Digitalmars-d-learn mailing list