Proposal: __traits(getComment, symbol)
Petar
Petar
Thu Aug 29 11:08:33 UTC 2019
On Thursday, 29 August 2019 at 10:20:28 UTC, RazvanN wrote:
> On Wednesday, 28 August 2019 at 22:18:28 UTC, Max Haughton
> wrote:
>> On Wednesday, 28 August 2019 at 17:35:56 UTC, Manu wrote:
>>> As a development workflow feature, having compiler access to
>>> symbol comments would be very useful in many cases.
>>
>> Speaking of which, has anyone tried/discussed giving access to
>> a frozen version of the AST through (say) __traits(getAST,
>> symbol)? I'd try it myself but I haven't spent the time
>> learning how dmd works.
>
> Whatever you want to do with traits(getAST) would likely be a
> job for dmd as a library.
The use cases for traits(getAST) are CTFE-only by definition
(think implementing AST-macros), so using dmd as a library is not
an option.
See for example:
https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/concepts/expression-trees/
https://doc.rust-lang.org/reference/procedural-macros.html
https://doc.rust-lang.org/1.30.0/book/2018-edition/appendix-04-macros.html
https://nim-lang.github.io/Nim/tut3.html
https://nim-lang.org/blog/2018/06/07/create-a-simple-macro.html
https://nim-lang.github.io/Nim/manual.html#macros
BTW, we had a long discussion about that on Slack a while ago:
https://dlang.slack.com/archives/C1ZDHBB2S/p1511992601000433
More information about the Digitalmars-d
mailing list