digitalmars.D.learn - Ordering of UDAs
- Emmanuelle (2/2) Apr 22 2019 Hello! Does `__traits(getAttributes, ...)` return UDAs in the
- Adam D. Ruppe (14/17) Apr 22 2019 I think that is defined:
- Emmanuelle (2/19) Apr 22 2019 Alright, that makes enough sense to me. Thank you!
Hello! Does `__traits(getAttributes, ...)` return UDAs in the order they were declared in the source code, or is it unspecified?
Apr 22 2019
On Monday, 22 April 2019 at 19:02:57 UTC, Emmanuelle wrote:Hello! Does `__traits(getAttributes, ...)` return UDAs in the order they were declared in the source code, or is it unspecified?I think that is defined: https://dlang.org/spec/attribute.html#uda "If there are multiple UDAs in scope for a declaration, they are concatenated: " and the example shows it in order. It also says "Whether the attributes are values or types is up to the user, and whether later attributes accumulate or override earlier ones is also up to how the user interprets them. " Which implies it must be in order so you can make that determination. It isn't as specific as I'd like, but it sure sounds like it must be in order to me.
Apr 22 2019
On Monday, 22 April 2019 at 19:32:27 UTC, Adam D. Ruppe wrote:On Monday, 22 April 2019 at 19:02:57 UTC, Emmanuelle wrote:Alright, that makes enough sense to me. Thank you!Hello! Does `__traits(getAttributes, ...)` return UDAs in the order they were declared in the source code, or is it unspecified?I think that is defined: https://dlang.org/spec/attribute.html#uda "If there are multiple UDAs in scope for a declaration, they are concatenated: " and the example shows it in order. It also says "Whether the attributes are values or types is up to the user, and whether later attributes accumulate or override earlier ones is also up to how the user interprets them. " Which implies it must be in order so you can make that determination. It isn't as specific as I'd like, but it sure sounds like it must be in order to me.
Apr 22 2019