digitalmars.D.learn - Why is there no throws, gc, impure, mutable ?
- wjoe (5/5) Sep 07 2020 It's easy to declare the entire module @safe and functions which
- Paul Backus (10/15) Sep 07 2020 Mostly because nobody's bothered to add them (yet). There's an
- wjoe (2/19) Sep 07 2020 Very interesting. Thanks.
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 ?
Sep 07 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. [1] https://github.com/dlang/DIPs/blob/master/DIPs/accepted/DIP1029.md [2] http://dpldocs.info/experimental-docs/std.traits.Unconst.html
Sep 07 2020
On Monday, 7 September 2020 at 11:44:40 UTC, Paul Backus wrote:On Monday, 7 September 2020 at 11:25:15 UTC, wjoe wrote:Very interesting. Thanks.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. [1] https://github.com/dlang/DIPs/blob/master/DIPs/accepted/DIP1029.md [2] http://dpldocs.info/experimental-docs/std.traits.Unconst.html
Sep 07 2020