Expanded source code

BCS ao at pathlink.com
Wed Jun 17 11:03:10 PDT 2009


Reply to Paul,

> Is there a way to see the source for a D program after the mixins and
> templates, etc., are expanded?
> 

Descent has a "compile time view" that is supposed to do some of this.

If you are only looking at string mixins you can use pragma(msg, string) 
to view the string

> I get occasional error messages saying I've got incompatible types,
> for example, but the error message only makes sense when I mentally
> instantiate a template. Is there a way to see this instantiation in
> print?
> 
> At what phase of compilation does this occur? Has the code been
> tokenized? (It's okay with me if it is--I just want to know.)
> 

This is mostly informed guess work but: it's all mixed up; the file is tokenized 
and parsed, then some semantic stuff happens including some template evaluation 
and CTFE to construct the string that is then tokenized and your back where 
you started. In concept, the tokenization, parsing and semantics are different 
phases. The first two might happen at the same time but I think the third 
is separate.

> Paul
> 




More information about the Digitalmars-d-learn mailing list