DMD as a library package can now run through all semantic phases

Seb seb at wilzba.ch
Sat Jan 27 01:36:17 UTC 2018


On Saturday, 27 January 2018 at 01:25:18 UTC, timotheecour wrote:
> On Friday, 26 January 2018 at 18:40:23 UTC, Seb wrote:
>> Want to know what it prints? Run the file!
>> Spoiler: it's similar to new the AST feature at run.dlang.io:
>
>
> prettyPrint produces valid D code except for template 
> instantiations:
> ```
> writeln!int
>  {
>      @safe void writeln(int _param_0)
>      {
>          import std.traits : isAggregateType;
>          ((File __tmpfordtor37 = trustedStdout();) , 
> __tmpfordtor37).write(_param_0, '\x0a');
>      }
>
>  }
> ```
>
> why not write something like:
> ```
> template writeln(T:int)
> {
> ...
> }
> ```
> or template writeln(T) if(is(T==int))


Agreed, but prettyPrint:

https://github.com/dlang/dmd/blob/master/src/dmd/frontend.d#L275

is just a nice wrapper around the existing PrettyPrintVisitor:


https://github.com/dlang/dmd/blob/master/src/dmd/hdrgen.d#L84


More information about the Digitalmars-d mailing list