August 01, 2013
On Thu, Aug 01, 2013 at 10:37:50AM -0700, Walter Bright wrote:
> On 8/1/2013 9:53 AM, H. S. Teoh wrote:
> >Y'know, one feature I've always wanted is the equivalent of preprocessed C code -- with all mixins expanded, aliases substituted with their final target, templates fully expanded, all syntactic sugar lowered, with the original code lines in comments, so that you can see exactly how your code was translated, and whether it matches what you *think* it does.  This would also be invaluable for debugging, as then it will map to the assembly code much better, which will help you trace where things went wrong.
> 
> I do this with a debug build of the compiler. Using --b will give you the expression trees sent to the back end.

It'd be nice if this was documented somewhere. ;-)


T

-- 
Too many people have open minds but closed eyes.
August 01, 2013
On Thursday, 1 August 2013 at 17:45:16 UTC, H. S. Teoh wrote:
> On Thu, Aug 01, 2013 at 10:37:50AM -0700, Walter Bright wrote:
>> On 8/1/2013 9:53 AM, H. S. Teoh wrote:
>> >Y'know, one feature I've always wanted is the equivalent of
>> >preprocessed C code -- with all mixins expanded, aliases substituted
>> >with their final target, templates fully expanded, all syntactic
>> >sugar lowered, with the original code lines in comments, so that you
>> >can see exactly how your code was translated, and whether it matches
>> >what you *think* it does.  This would also be invaluable for
>> >debugging, as then it will map to the assembly code much better,
>> >which will help you trace where things went wrong.
>> 
>> I do this with a debug build of the compiler. Using --b will give
>> you the expression trees sent to the back end.
>
> It'd be nice if this was documented somewhere. ;-)
>
>
> T

So your saying I have to have the debug build of dmd and run it on my code with --b and somewhere it will output the expanded code?