nothrow by default

apz28 home at
Sun Jan 5 04:37:57 UTC 2020

On Saturday, 4 January 2020 at 21:07:03 UTC, Adam D. Ruppe wrote:
> On Saturday, 4 January 2020 at 20:53:34 UTC, Dennis wrote:
>> Walter's current plan seems to be allowing the `throw` keyword 
>> to be used as an attribute.
> that looks good to me btw. I'm against the default change but 
> that DIP appears to do what I'd want - the negating behavior is 
> also well done.
>> That still leaves the question how @nogc and pure will be 
>> negated, and how to specify the default attributes for a 
>> module without affecting template functions and functions with 
>> `auto` return-type.
> lol we could always use existing keywords like crazy:
> pure!false
> @nogc!true
> nothrow!default
> virtual!false
> or something similar.
> gotta love the double negatives but meh. throw already being a 
> keyword is convenient. pure is already positive so convenient. 
> just @nogc, the odd one out.
> but like regardless i wouldn't oppose such a thing.
> i also wouldn't oppose impure and @gc keywords added.
> I also wouldn't oppose templates simply not being affected by 
> scope-level keyword attributes. That might be a winner 
> actually.... maybe. If you want it to apply to the template, 
> you'd just have to explicitly write it again. They get special 
> case because of the inference rule.
> Could also mean
> @safe class Foo {
>    final void my_template()(); // actually inferred, despite 
> outer @safe
> }
> idk, just throwing out ideas. To be honest I'd take just about 
> *anything* that actually happens now over some other idea that 
> we have to wait several years for again.

D should make attribute keywords consistent by adding inversed 
value using "!". This will help to reduce the number of 
attributes and a way to inverse the block setting. For any 
attributes that support block in form of ...":" or ...{...}, it 
should apply to all functions & function/delegate alias.
@trusted is a dangerous construct and should not be allowed to be 
use in block construct.

@!gc => as current @nogc and depreciate @nogc
!throw => as current nothrow and depreciate nothrow
@!safe => as current @system and depreciate @system

More information about the Digitalmars-d mailing list