impure

Dom DiSc dominikus at scherkl.de
Mon Apr 8 07:46:08 UTC 2024


On Sunday, 7 April 2024 at 23:32:24 UTC, MrJay wrote:
> A better way to apply a attribute to an entire file is to use 
> an explicit scope you can still apply this to basically the 
> entire file but leave the tests out of it.

Better than an explicit impure (or pure=false) attribute?
I don't think so. It heavily uglyfies the file, as single items 
without a specific attribute are interspersed in the file. So the 
scope need to end before and start again after the affected 
function or test.

An it stops working at all if e.g. one test is impure and another 
test is @gc, because then the scopes overlap and can no more be 
contained in each other.

Really, having the counter-attributes would improve the language.


More information about the Digitalmars-d-learn mailing list