Compile time executable calling?

Timothee Cour thelastmammoth at gmail.com
Fri Jul 12 16:33:52 PDT 2013


On Fri, Jul 12, 2013 at 3:36 PM, Peter Alexander <
peter.alexander.au at gmail.com> wrote:

> On Friday, 12 July 2013 at 20:42:50 UTC, Tofu Ninja wrote:
>
>> So I had an idea recently, wouldn't it be cool to have the ability to
>> call an executable at compile time and capture its output.
>>
>
> How long until D compilers are able to read mail? :-)
>
> There's many obvious applications of this proposed feature, but I say such
> things should be delegated to the build process. Just run those executables
> using a makefile, or whatever build system you use.
>
> If you need compile time inputs from your D code then just run a separate
> build to extract them. Yes it's more work and less convenient, but I think
> we need to be careful with how much is added to the D compilers. We don't
> want to turn them into operating systems.
>

regarding added complexity: the only thing this adds is 1 function (calling
an executable, with option to redirect stdin/out/err). And yes, that could
read mail as you joked if the user called such a program inside his D
function, but that would require ZERO change in compiler, apart from that
ONE function to support calling external programs.

we need this for the same reason we need CTFE: try using makefiles to
achieve what CTFE does. Using a separate build is way less convenient and
doesn't allow complex interactions, as it requires the process to be
sequential: do other stuff THEN compile with dmd. Whereas integrating it
inside compilation would allow interdependent computations offloaded to an
external process.

With makefile-like build, you'd have to have potentially many layers of
interaction between compiling and calling external programs. Not only would
that be much slower (dmd has overhead), but would also require parsing
files each time.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20130712/b98c866f/attachment.html>


More information about the Digitalmars-d mailing list