A new trait to retrieve doc comments (if available).

Jacob Carlborg via Digitalmars-d digitalmars-d at puremagic.com
Mon May 5 23:14:34 PDT 2014


On 06/05/14 02:49, Mason McGill wrote:
> **I'm fairly new to D, so let me know if this belongs in another thread.**
>
> I'd like to contribute a new feature to the DMD front-end, and I'd
> appreciate some feedback on the design before I start on a pull request.
>
> Feature:
> ========
> `__traits(comment, symbol)` will evaluate to the doc-comment of
> `symbol`, if it is available, and "", otherwise. For DMD, this means it
> will provide comment information if the "-D" compiler option is used.
> Other implementations can choose to always evaluate it to "".
>
> Use Cases:
> ==========
> Here's my use case: I'm building an automatic wrapper generator for
> binding D to dynamic languages (mostly for scientific applications, at
> the moment). It's like SWIG, but more automated and narrower in scope.
> Right now, I have two suboptimal options for supporting documentation
> comments:

I have thought about it a couple of times before. I would say, just go 
for it. __traits is a pretty good staring point for someone not familiar 
with the DMD source.

-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list