Thread overview
Compile without generating code
Jul 05, 2017
Lewis
Jul 05, 2017
Stefan Koch
Jul 06, 2017
Johannes Pfau
Jul 07, 2017
Lewis
Jul 07, 2017
Suliman
Jul 07, 2017
bauss
Jul 07, 2017
Moritz Maxeiner
July 05, 2017
I was reading https://blog.rust-lang.org/2017/07/05/Rust-Roadmap-Update.html, which mentioned that the Rust compiler now has a mode to go through the motions of compiling and show errors, but without generating any code. This way you can do a much faster build while iterating until you have no compile errors, then do a single build with code generation once everything looks good.

I was wondering what people's thoughts on this was. I haven't gone digging through DMD's codebase recently. Is DMD set up in such a way that this would be feasible to implement? Does this even make sense with the way DMD generates code, or would it only work for a language like Rust that does a ton of compile-time checking?

DMD already compiles pretty fast, and this strikes me as a useful feature to further cement D's competitive edge with respect to compilation speed.
July 05, 2017
On Wednesday, 5 July 2017 at 21:58:45 UTC, Lewis wrote:
> I was reading https://blog.rust-lang.org/2017/07/05/Rust-Roadmap-Update.html, which mentioned that the Rust compiler now has a mode to go through the motions of compiling and show errors, but without generating any code. This way you can do a much faster build while iterating until you have no compile errors, then do a single build with code generation once everything looks good.
>
> [...]

We already have it.
use -o- and it'll disable codegen.
July 06, 2017
Am Wed, 05 Jul 2017 22:05:53 +0000
schrieb Stefan Koch <uplink.coder@googlemail.com>:

> On Wednesday, 5 July 2017 at 21:58:45 UTC, Lewis wrote:
> > I was reading https://blog.rust-lang.org/2017/07/05/Rust-Roadmap-Update.html, which mentioned that the Rust compiler now has a mode to go through the motions of compiling and show errors, but without generating any code. This way you can do a much faster build while iterating until you have no compile errors, then do a single build with code generation once everything looks good.
> >
> > [...]
> 
> We already have it.
> use -o- and it'll disable codegen.

And GDC supports the standard -fsyntax-only GCC flag.


-- Johannes

July 07, 2017
On Wednesday, 5 July 2017 at 22:05:53 UTC, Stefan Koch wrote:
> On Wednesday, 5 July 2017 at 21:58:45 UTC, Lewis wrote:
>> I was reading https://blog.rust-lang.org/2017/07/05/Rust-Roadmap-Update.html, which mentioned that the Rust compiler now has a mode to go through the motions of compiling and show errors, but without generating any code. This way you can do a much faster build while iterating until you have no compile errors, then do a single build with code generation once everything looks good.
>>
>> [...]
>
> We already have it.
> use -o- and it'll disable codegen.

Well there you go, D is already ahead of the game. Thanks!
July 07, 2017
On Wednesday, 5 July 2017 at 22:05:53 UTC, Stefan Koch wrote:
> On Wednesday, 5 July 2017 at 21:58:45 UTC, Lewis wrote:
>> I was reading https://blog.rust-lang.org/2017/07/05/Rust-Roadmap-Update.html, which mentioned that the Rust compiler now has a mode to go through the motions of compiling and show errors, but without generating any code. This way you can do a much faster build while iterating until you have no compile errors, then do a single build with code generation once everything looks good.
>>
>> [...]
>
> We already have it.
> use -o- and it'll disable codegen.


How to use this parameter with dub?

July 07, 2017
On Friday, 7 July 2017 at 11:14:40 UTC, Suliman wrote:
> On Wednesday, 5 July 2017 at 22:05:53 UTC, Stefan Koch wrote:
>> On Wednesday, 5 July 2017 at 21:58:45 UTC, Lewis wrote:
>>> I was reading https://blog.rust-lang.org/2017/07/05/Rust-Roadmap-Update.html, which mentioned that the Rust compiler now has a mode to go through the motions of compiling and show errors, but without generating any code. This way you can do a much faster build while iterating until you have no compile errors, then do a single build with code generation once everything looks good.
>>>
>>> [...]
>>
>> We already have it.
>> use -o- and it'll disable codegen.
>
>
> How to use this parameter with dub?

"buildOptions" with "syntaxOnly"
July 07, 2017
On Friday, 7 July 2017 at 11:14:40 UTC, Suliman wrote:
> On Wednesday, 5 July 2017 at 22:05:53 UTC, Stefan Koch wrote:
>> On Wednesday, 5 July 2017 at 21:58:45 UTC, Lewis wrote:
>>> I was reading https://blog.rust-lang.org/2017/07/05/Rust-Roadmap-Update.html, which mentioned that the Rust compiler now has a mode to go through the motions of compiling and show errors, but without generating any code. This way you can do a much faster build while iterating until you have no compile errors, then do a single build with code generation once everything looks good.
>>>
>>> [...]
>>
>> We already have it.
>> use -o- and it'll disable codegen.
>
>
> How to use this parameter with dub?

Via `dflags` [1][2]

[1] https://code.dlang.org/package-format?lang=json#build-settings
[2] https://code.dlang.org/package-format?lang=sdl#build-settings