Named constructors

H. S. Teoh hsteoh at quickfur.ath.cx
Thu Jan 10 16:33:51 UTC 2019


On Thu, Jan 10, 2019 at 02:00:25PM +0000, Atila Neves via Digitalmars-d wrote:
> On Thursday, 10 January 2019 at 12:37:38 UTC, H. S. Teoh wrote:
[...]
> > Don't worry, this is Atila we're talking about. If he comes up with
> > any solution, you can be sure it will not hurt his precious compile
> > times!  ;-)
> 
> Actually, they're so bad right now anyway from a baseline of acceptability
> to me that nothing I add on top makes it that much worse. Currently
> I'm trying to work out an efficient way to interpret D to run unit
> tests so I don't have to pay the linker tax and just avoid compiling
> code whilst developing. It'll be a lot of work, though... :(

Recently I've started to compile unittests separately from the final
executable. The default behaviour of running unittests before main() is
nice for one-off scripts and short-term projects, but for serious code
I'm finding more and more that it makes more sense to compile and run
unittests separately.  I haven't gotten to the point of evading linker
tax, though.

But I surmise it should be relatively easy to just compile modules
separately with -unittest -run, using -i to automatically pick up
imports. Put this in a test target in your build script and have the
tests built and run incrementally. Not sure how much time will be saved,
due to -i potentially causing the same tests to run multiple times. I
should try this out on one of my larger projects to see how it does.


T

-- 
They pretend to pay us, and we pretend to work. -- Russian saying


More information about the Digitalmars-d mailing list