Compile time executable calling?
Ary Borenszweig
ary at esperanto.org.ar
Sat Jul 13 09:05:52 PDT 2013
On 7/12/13 5:42 PM, 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. Something
> like the string imports but instead of opening and reading a text file,
> it run an executable, waits for it to finish, and grabs its output.
>
> It would get really cool if you could pass this executable some args and
> then mix in its out put into your own code. It could be used similarly
> to how CTFE are used but with out the overhead of trying to compile that
> function and what not and with out the limitations on what it can do.
>
> I could imagine all sorts of things that would be possible with this
> that is currently not.
>
> Not sure if this is something that could be implemented easily, but
> seems like something that could be done and something that would be
> really cool.
What would actually be cool is to run any kind of code at compile time
(within a sandbox, if you want). For example reading a mysql database
and generating classes for the tables at compile time. No need to run a
separate executable and remember to run it before compiling your program.
But this has been discussed many times in this list, and it won't
happen, because compile time functions are not jitted and run, they are
just interpreted.
You ask for executing a program at compile time. Somebody will ask
reading a file at compile time. Another one will ask reading a schema
from a database. Yet another will want to do a web scraper at compile
time to generate efficient code from that (not sure that's useful :-P)
More information about the Digitalmars-d
mailing list