On 8/12/2016 12:14 PM, Shachar Shemesh wrote:
On 12/08/16 22:07, Walter Bright wrote:
On 8/12/2016 7:41 AM, Shachar Shemesh wrote:
That table was not expensive to compute, and its constantness wasn't
crucial
enough even for me to put a wrapper pointer and only access it through
it. Had
that not been the case, and had that table been more expensive to
computer, I'd
probably compute at compile time with an external tool.

What I do (and is done in building DMD) is write a program (optabgen.c)
to generate the tables and write a C++ source file, then compile the
generated file into DMD.

Yes, I'm sorry. I meant to say "build time" instead of "compile time". That is
precisely what I meant.

I'm surprised that I've never seen anyone else use such a technique. It's so unusual I've seen it be unrepresentable in some 'make' replacements.

I suppose it's like unittest and ddoc. Sure, you can do it with some contortions and/or some external tooling, but having it conveniently built in to the language changes everything.

Reply via email to