Thread overview | ||||||
---|---|---|---|---|---|---|
|
September 15, 2016 [UDA] Error: first argument is not a symbol | ||||
---|---|---|---|---|
| ||||
https://dpaste.dzfl.pl/9548c481ce46 shouldn't commented line return 'false' as built-in type 'int' has no any UDAs instead of cryptic (for me) message about wrong first argument? |
September 15, 2016 Re: [UDA] Error: first argument is not a symbol | ||||
---|---|---|---|---|
| ||||
Posted in reply to drug | On 9/15/16 4:48 AM, drug wrote:
> https://dpaste.dzfl.pl/9548c481ce46
>
> shouldn't commented line return 'false' as built-in type 'int' has no
> any UDAs instead of cryptic (for me) message about wrong first argument?
This is due to int not being a symbol, which apparently __traits(getAttributes, ...) requires.
int is a keyword and not considered a symbol. An annoying distinction without a difference in this case. I'd say it's something we should fix, but this kind of problem has existed forever. Not sure if it will get attention.
-Steve
|
September 15, 2016 Re: [UDA] Error: first argument is not a symbol | ||||
---|---|---|---|---|
| ||||
Posted in reply to Steven Schveighoffer | 15.09.2016 15:56, Steven Schveighoffer пишет:
>
> This is due to int not being a symbol, which apparently
> __traits(getAttributes, ...) requires.
>
> int is a keyword and not considered a symbol. An annoying distinction
> without a difference in this case. I'd say it's something we should fix,
> but this kind of problem has existed forever. Not sure if it will get
> attention.
>
> -Steve
Thank you for answer
|
September 15, 2016 Re: [UDA] Error: first argument is not a symbol | ||||
---|---|---|---|---|
| ||||
Posted in reply to Steven Schveighoffer | On Thursday, September 15, 2016 08:56:18 Steven Schveighoffer via Digitalmars- d-learn wrote: > On 9/15/16 4:48 AM, drug wrote: > > https://dpaste.dzfl.pl/9548c481ce46 > > > > shouldn't commented line return 'false' as built-in type 'int' has no any UDAs instead of cryptic (for me) message about wrong first argument? > > This is due to int not being a symbol, which apparently > __traits(getAttributes, ...) requires. > > int is a keyword and not considered a symbol. An annoying distinction without a difference in this case. I'd say it's something we should fix, but this kind of problem has existed forever. Not sure if it will get attention. Given the fact that Walter theoretically agreed to fix it so that alias parameters accepted built-in types and not just symbols, that might translate to treating int and friends as symbols in general, which would fix this case. I don't know. There's certainly no need to ever check whether a built-in type has a UDA, because it never will, so in that respect, it doesn't really matter, but it could become annoying in generic code, because you might have to explicitly check for built-in symbols to workaround this. I've opened an enhancement request: https://issues.dlang.org/show_bug.cgi?id=16496 - Jonathan M Davis |
Copyright © 1999-2021 by the D Language Foundation