www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - How/where to hack DMD to generate docs for string mixed members.

reply 9il <ilyayaroshenko gmail.com> writes:
Hey,

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

struct S
{
     mixin("
      ///
      auto bar() {}
     ");
}

Best regards,
Ilya Yaroshenko
Apr 14 2018
parent reply Stefan Koch <uplink.coder googlemail.com> writes:
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
Apr 15 2018
next sibling parent reply Jonathan M Davis <newsgroup.d jmdavisprog.com> writes:
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
Apr 15 2018
parent reply 9il <ilyayaroshenko gmail.com> writes:
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.
Apr 16 2018
parent Jonathan M Davis <newsgroup.d jmdavisprog.com> writes:
On Monday, April 16, 2018 16:05:40 9il via Digitalmars-d-learn wrote:
 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.
Well, the fact that the compiler doesn't display any ddoc from string mixins is one of those annoying things that has come up from time to time for years now. I don't know what the consequences of changing that behavior would be, but on the surface at least, it seems like it would be a positive change. Regardless, someone would have to make the change to the compiler, and AFAIK, that particular improvement has never been a priority for anyone, but I don't pay much attention to dmd PRs. A quick search turns up this bug report: https://issues.dlang.org/show_bug.cgi?id=2420 And it looks like that one links to this fixed bug https://issues.dlang.org/show_bug.cgi?id=648 which looks like it was when it became possible to at least mark a template mixin with /// to make its ddoc show up. - Jonathan M Davis
Apr 16 2018
prev sibling parent 9il <ilyayaroshenko gmail.com> writes:
On Sunday, 15 April 2018 at 07:59:17 UTC, Stefan Koch 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
-vcg-ast does not help: --- import object; struct S { mixin("\x0a ///\x0a auto bar() {}\x0a "); } RTInfo!(S) { enum typeof(null) RTInfo = null; } --- Is it bug or is it possible to improve it?
Apr 16 2018