dlangspec.pdf?

H. S. Teoh hsteoh at quickfur.ath.cx
Wed Jan 9 12:45:15 PST 2013


On Wed, Jan 09, 2013 at 12:16:56PM -0800, Andrei Alexandrescu wrote:
> On 1/9/13 12:13 PM, Walter Bright wrote:
> >On 1/9/2013 12:03 PM, Philippe Sigaud wrote:
> >>That's not what I'm talking about, sorry for not being clear. I don't
> >>care for the origin of the data, obviously. I meant a D module, not a
> >>file specifically. My question was if the data is a D module (code +
> >>comments), should it just expand macros? Or should it generate a
> >>documentation?
> >
> >The current ddoc macro system does recognize D code. This should be
> >removed from a generic macro system.
> 
> Yah, the "----" etc. I was thinking it would be nice to have some of
> that functionality, too.
[...]

I think the D-specific parts (or even documentation-specific parts, like
the syntax for sections) should be done separately.  Maybe something
like this:

	// In the generic macro module
	R expandMacros(I,R)(I inputRange, string[string] macroDefs) { ...}

	// In a doc-specific module
	R extractDocComments(I,R)(I inputRange) { ... }
	R processDocSections(I,R)(I inputRange) { ... }

	// In main app
	R generateDdoc(I,R)(I inputRange, string[string] macroDefs) {
		// UFCS FTW!
		return inputRange.extractDocComments()
				.expandMacros(macroDefs)
				.processDocSections();
	}


T

-- 
Your inconsistency is the only consistent thing about you! -- KD


More information about the Digitalmars-d mailing list