uda pattern foo and foo(val)

Steven Schveighoffer schveiguy at gmail.com
Wed Sep 23 03:31:55 UTC 2020

On 9/22/20 10:20 PM, Adam D. Ruppe wrote:
> On Wednesday, 23 September 2020 at 02:07:04 UTC, Steven Schveighoffer 
> wrote:
>> I just said pragma(msg, __traits(getAttributes, z))
> Ah, ok, this is weird, `pragma(msg, __traits(getAttributes, z)[0])` 
> works just fine!

Oh, yeah, weird! I see that now. So it will actually work, it's just my 
method of testing "will this work", which actually isn't how I would use 
it, triggers some obscure bug, lol.

> But that might be adequate for you - just loop over the attributes and 
> use them one by one. Which you'd do anyway.

Yep, exactly what I would be doing anyway.

> I suspect this is overload resolution not happening yet when you 
> getAttributes but then it happens when it is forced evaluated with the 
> index. (prolly one of those order-of-semantic bugs in dmd)

I thought it had something to do with the optional parentheses.

Thanks anyway for helping!


More information about the Digitalmars-d-learn mailing list