On Monday, November 25, 2019 9:25:08 AM MST ParticlePeter via Digitalmars-d- learn wrote: > I am producing a bunch of functions/methods through string > mixins. I also generated DDoc comments for those functions, in > the hope that they would produce proper documentation, but they > don't. So how can this be accomplished?
Right now, you don't. The ddoc and function signature have to be directly in the source code for them to be seen for ddoc generation. The closest I'm aware of to being able to do anything along the lines of mixing in documentation is to use template mixins, and IIRC, you not only have to have ddoc on the mixed in symbols, but you need to put at least an empty ddoc comment on the statement that mixes in the template. e.g. std.exception has /++ ... +/ mixin template basicExceptionCtors() { /++ Params: msg = The message for the exception. file = The file where the exception occurred. line = The line number where the exception occurred. next = The previous exception in the chain of exceptions, if any. +/ this(string msg, string file = __FILE__, size_t line = __LINE__, Throwable next = null) @nogc @safe pure nothrow { super(msg, file, line, next); } /++ Params: msg = The message for the exception. next = The previous exception in the chain of exceptions. file = The file where the exception occurred. line = The line number where the exception occurred. +/ this(string msg, Throwable next, string file = __FILE__, size_t line = __LINE__) @nogc @safe pure nothrow { super(msg, file, line, next); } } and to have those constructors show up in the documentation when mixed in, you have to do something like: /++ My exception class. +/ class MyException : Exception { /// mixin basicExceptionCtors; } Without the empty ddoc comment, the documentation on the mixed in symbols does not show up, but either way, nothing like that can currently be done with string mixins. There's on open bug report / enhancement request somewhere on bugzilla to fix it so that you can document string mixins, but unless someone has done something to fix that very recently, no one has yet to implement a fix. - Jonathan M Davis