> Jonathan M Davis: > > But honestly, what you're trying to do just strikes me as plain weird. > > Maybe it's a typical thing to do in scripting languages, but it > > definitely isn't in compiled languages. > > It's very common in well designed Python modules. Probably you don't see it > in compiled languages like C/C++ because they don't have a good module > system. D has modules related to Python ones, so I am using this Python > idiom in D too. Most D1 modules of dlibs1 have demo code :-)
I really don't understand what you're trying to do with a module "demo." The unit tests test the code in the module. They also provide examples on how to use the code in the module. Also, well-written modules have good examples in their documentation (which is generally tested in the unit tests as well). What is a module demo supposed to achieve that good unit tests and documentation don't? - Jonathan M Davis