On Fri, 17 Jan 2014 22:25:11 -0500, Stanislav Blinov <[email protected]> wrote:

On Saturday, 18 January 2014 at 03:02:45 UTC, Steven Schveighoffer wrote:

I think a "use the attributes of X" would be a general enough tool.

Something like:

 void thisIsSoPolymorphic() attrOf(T.foo)

And here is where I would disagree. Fine-grained control over each attribute is more important. For example, the function may be always nothrow (say I handle all the exceptions in the world or assert(0) on what's left; D helpfully doesn't consider assert(0) as throwing :) ), but it may be conditionally pure or safe.

void thisIsSoPolymorphic() attrOf(T.foo) nothrow

I would assume, we could come up with ways to mask out attributes you want to set specifically. For example if you always want it NOT to be nothrow, you could do something like:

void thisIsSoPolymorphic() attrOf(withoutNothrow!(T.foo))

-Steve

Reply via email to