nothrow by default

Adam D. Ruppe destructionator at gmail.com
Sat Jan 4 21:07:03 UTC 2020


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.
>
> https://github.com/dlang/DIPs/pull/167/files

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.


More information about the Digitalmars-d mailing list