digitalmars.D.learn - Expanded source code
- Paul D. Anderson (4/4) Jun 17 2009 Is there a way to see the source for a D program after the mixins and te...
- BCS (10/23) Jun 17 2009 Descent has a "compile time view" that is supposed to do some of this.
- Ary Borenszweig (3/17) Jun 17 2009 You can also debug the template instantiation with Descent.
- Paul D. Anderson (12/20) Jun 18 2009 Thanks for the help. So the short answer is no.
- Ary Borenszweig (4/16) Jun 19 2009 I thought the short answer was yes. Did you try Descent? You can hover a...
- Paul D. Anderson (6/23) Jun 19 2009 Sorry, didn't mean to sound ungrateful. I appreciate your help, but...
Is there a way to see the source for a D program after the mixins and templates, etc., are expanded? 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.) Paul
Jun 17 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 stringI 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
Jun 17 2009
BCS escribió:Reply to Paul,You can also debug the template instantiation with Descent. But only for D1, aw...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 stringI 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.
Jun 17 2009
Paul D. Anderson Wrote:Is there a way to see the source for a D program after the mixins and templates, etc., are expanded? 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.) PaulThanks for the help. So the short answer is no. A related question: which D language constructs do (virtual) text substitution? My list: * alias * mixin * special tokens * special token sequences * templates * template mixins Are there others? Paul
Jun 18 2009
Paul D. Anderson wrote:Paul D. Anderson Wrote:I thought the short answer was yes. Did you try Descent? You can hover a template instance to see it's expansion. Same goes with mixins. Doesn't this help you?Is there a way to see the source for a D program after the mixins and templates, etc., are expanded? 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.) PaulThanks for the help. So the short answer is no.
Jun 19 2009
Ary Borenszweig Wrote:Paul D. Anderson wrote:Sorry, didn't mean to sound ungrateful. I appreciate your help, but... I don't use Descent -- the last time I tried to use it (and I know it's been improved a lot) I couldn't get it installed properly. But it sounds like Descent does what I want. I was looking for a non-IDE specific variety. And, oh yeah, I need it for D2. Maybe I'll peek at the Descent implementation and see if I can't come up with something that I can pull from there. Again, thanks. PaulPaul D. Anderson Wrote:I thought the short answer was yes. Did you try Descent? You can hover a template instance to see it's expansion. Same goes with mixins. Doesn't this help you?Is there a way to see the source for a D program after the mixins and templates, etc., are expanded? 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.) PaulThanks for the help. So the short answer is no.
Jun 19 2009