April 01, 2018
Have you ever wondered why `pragma(msg, "foo")` is appearing twice when compiling something with rdmd?
Well, it's because rdmd is compiling the program twice and with evaluating all the Phobos template monstrosities this is easily ~30-40% of the entire build.

There have been many attempts at fixing this and in 2.079 we finally got -i:

https://dlang.org/changelog/2.079.0.html#includeimports
https://github.com/dlang/dmd/pull/7099

However, all attempts of fixing this in rdmd have failed:

- https://github.com/dlang/tools/pull/191 (before -i, closed in favor of #194)
- https://github.com/dlang/tools/pull/194 (was reverted due to a regression)
- https://github.com/dlang/tools/pull/271 (was reverted to maintain backwards compatibility)
- https://github.com/dlang/tools/pull/292 (was closed due to too much resistance)

So it doesn't look like in 2.080 rdmd will take advantage of this.

Yo, no problem I can use `alias rdmd=dmd -run -i` now, right?
--------------------------------------------------------------

Well, not so fast `-run` has severe design defects. See https://github.com/dlang/dmd/pull/7927).
tl;dr: you can use `-i`, but you will need to use a custom wrapper like e.g. this one:

---
#!/bin/bash

DMD="${DMD:-dmd}"
file="$1"
other_flags=()
shift

for arg in "$@" ; do
    if [ -f "$arg" ] ; then
        other_flags+=("$file")
        file="$arg"
    else
        other_flags+=("$arg")
    fi
done

"$DMD" -i "${other_flags[@]}" -run "${file}"
---


Oh and if you don't like this wrapper, a fork of rdmd is here: https://github.com/marler8997/rund