Parallel execution of unittests
bearophile via Digitalmars-d
digitalmars-d at puremagic.com
Mon May 5 04:26:29 PDT 2014
Jonathan M Davis:
> Just because something is done in
> python does not mean that it is appropriate for D or that it
> requires adding features to D in order to support it.
I agree. On the other hand now I have years of experience in both
language and I still have this need in D.
> It makes no sense to me to make it so that
> any arbitrary module can be the main module for the program.
This feature is mostly for single modules, that you can download
from archives, the web, etc. So it's for library code contained
in single modules. In Python code is usually short, so in a
single module you can implement many data structures, data
visualization, data converters, etc. So it's quite handy for such
modules to have demo, or even an interactive demo. Or they can be
used with command lines arguments (with getopt), like a sound
file converter. And then you can also import this module from
other modules to perform the same operation (like sound file
conversion) from your code. So you can use it both as a program
that does something, and as a module for a larger system.
> Such code should be kept separate IMHO.
This means that you now have two modules, so to download them
atomically you need some kind of packaging, like a zip. If your
project is composed by many modules this is not a problem. But if
you have a single module project (and this happens often in
Python), going from 1 to 2 files is not nice. I have written tens
of reusable D modules, and some of them have a demo or are usable
stand-alone when you have simpler needs.
> Maybe even many of those who use python would; I don't know.
In Python is a very commonly used idiom. And there is not much in
D that makes the same idiom less useful :-)
Bye,
bearophile
More information about the Digitalmars-d
mailing list