digitalmars.D - Lambda in UDA - undocumented behavior
- Andrey Zherikov (13/13) Jan 19 I was looking at dmd source code and found an undocumented
- Richard (Rikki) Andrew Cattermole (1/1) Jan 19 https://issues.dlang.org/show_bug.cgi?id=24346
- Andrey Zherikov (4/5) Jan 19 Does this mean it's a bug? :)
- Richard (Rikki) Andrew Cattermole (8/14) Jan 19 There is a bug here yes.
I was looking at dmd source code and found an undocumented behavior: ```d a=>7 int b; pragma(msg, __traits(getAttributes, b)); // AliasSeq!((a) => 7) ``` [D grammar](https://dlang.org/spec/grammar.html#UserDefinedAttribute) allows lambda in UDA only inside parenthesis: ```d (a=>7) int b; pragma(msg, __traits(getAttributes, b)); // AliasSeq!((a) => 7) ``` So is this a bug in compiler or in grammar documentation?
Jan 19
On Saturday, 20 January 2024 at 01:25:16 UTC, Richard (Rikki) Andrew Cattermole wrote:https://issues.dlang.org/show_bug.cgi?id=24346Does this mean it's a bug? :) tbh I'd like to try fixing it since I'm with that code atm.
Jan 19
On 20/01/2024 2:26 PM, Andrey Zherikov wrote:On Saturday, 20 January 2024 at 01:25:16 UTC, Richard (Rikki) Andrew Cattermole wrote:There is a bug here yes. The problem is it might be a compiler bug, or it could be a specification bug. Generally we consider the implementation to win on differences between the compiler and specification for issues such as this. Given that it does not appear to be harmful, no need to change the compiler :)https://issues.dlang.org/show_bug.cgi?id=24346Does this mean it's a bug? :) tbh I'd like to try fixing it since I'm with that code atm.
Jan 19