How/where to hack DMD to generate docs for string mixed members.

9il ilyayaroshenko at gmail.com
Mon Apr 16 16:05:40 UTC 2018


On Sunday, 15 April 2018 at 08:17:21 UTC, Jonathan M Davis wrote:
> On Sunday, April 15, 2018 07:59:17 Stefan Koch via 
> Digitalmars-d-learn wrote:
>> On Sunday, 15 April 2018 at 05:20:31 UTC, 9il wrote:
>> > Hey,
>> >
>> > How/where to hack DMD to generate docs for string mixed 
>> > members?
>> >
>> > struct S
>> > {
>> >
>> >     mixin("
>> >
>> >      ///
>> >      auto bar() {}
>> >
>> >     ");
>> >
>> > }
>> >
>> > Best regards,
>> > Ilya Yaroshenko
>>
>> hmm you should be able to see docs for string mixins, if not. 
>> try using -vcg-ast and try to run ddoc on the cg file
>
> AFAIK, it's never worked to see any ddoc from string mixins. 
> Certainly, I'm quite sure that it didn't used to work, so if it 
> does now, something changed within the last couple of years.
>
> The closest that I'm aware of is that putting /// on a template 
> mixin works so that you can do something like
>
> class MyException : Exception
> {
>     ///
>     mixin basicExceptionCtors;
> }
>
> and have the ddoc within the template mixin show up.
>
> - Jonathan M Davis

Mixin templates works. The problem is the use case for the 
library (you know it) I am working on is looks like:

------

struct S
{
     mixin(WithGetters!("private", // or WithGettersAndConstructor
         Date, "startDate",
		Date, "endDate",
		DayCount, "dayCount",
		double, "yearFraction",
		double, "spread",
		Calculation, "calculation",
     ));
}

------

It should define members and getters and maybe one or more 
constructors.
So mixin strings will be here anyway either in the struct or in a 
mixin template.



More information about the Digitalmars-d-learn mailing list