Adding pure to a function type
jmh530
john.michael.hall at gmail.com
Thu Oct 26 19:58:32 UTC 2017
On Thursday, 26 October 2017 at 19:08:56 UTC, Andrei Alexandrescu
wrote:
>
> One additional thing I noted is that I wanted to add
> attributes, not set them. I'd like some simpler primitives like
> AddPure, RemovePure etc. BTW the PR is
> https://github.com/dlang/phobos/pull/5470. -- Andrei
My above code could be easily adapted for adding attributes in
the general case. The doc unittest for SetFunctionAttributes has
an assumePure that shows how to add an attribute (though I'm not
sure on removing).
While I think that it makes sense to add an
AddFunctionAttributes/RemoveFunctionAttributes that match the
functionality of SetFunctionAttributes, it's probably more
convenient to also add an overload with a string template
parameter, so AddPure!T would just be AddFunctionAttributes!(T,
"pure") instead of AddFunctionAttributes!(T,
FunctionAttribute.pure_).
More information about the Digitalmars-d
mailing list