nothrow by default

Dennis dkorpel at gmail.com
Sat Jan 4 21:22:22 UTC 2020


On Saturday, 4 January 2020 at 21:07:03 UTC, Adam D. Ruppe wrote:
> 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.

So do you allow `nothrow!false` as well? Or:
- nothrow!(false)
- nothrow!0
- nothrow!(0 || false)
- throw!false
- throw!true

Also, which one gets put in the tuple when calling:

__traits(getFunctionAttributes, func);

Currently "@system", "@trusted" or "@safe" is always there, while 
"nothrow", "pure" and "@nogc" are either there or not. What is 
the canonical way to check that a function does not have the 
"nothrow" attribute? When there's multiple options, it's bound to 
be confusing.

It might be bikeshedding over the real issue (which is that it is 
still impossible to negate these attributes at all), but 
considering attribute soup is already a common complaint, I don't 
want it to become worse.


More information about the Digitalmars-d mailing list