On 03/16/2010 08:13 PM, Andrei Alexandrescu wrote:
This is solid work, but I absolutely refuse to believe the solution must be as complicated as this. Recall that the baseline is a 30-lines script. I can't bring myself to believe that a four-modules, over thousand lines solution justifies the added complexity.
I count 2 modules and about 800 loc. 2 to 300 of which implements functionality which doesn't exist in std.path but should. The ANTLR crap could be replaced by a hundred lines of handwritten code, but the grammar already existed and took less time.
Besides, what happened to std.getopt? You don't need to recognize dmd's options any more than rdmd does. rdmd dedicates only a few lines to argument parsing, dmdz makes it a science.
It started when I said, "huh. when is this thing building an executable, and when is it building a library?", and parsing dmd's options seemed like the most generally useful way of finding that out. I rather like the way it's turned out. eg during development:
$ dmdz dxl.zip -unittest > ... $ ./dxl/bin/dxl > ... "alright, unittests pass" $ dmdz dxl.zip > ... "now for the release executable" fwiw, I've never used rdmd due to bug 3860.
Don't take this the wrong way, the work is absolutely a tour de force. I'm just saying that things could be dramatically simpler with just a little loss of features. I'm looking over the code and am puzzled about the kind of gunpower that seems to be necessary for achieving the task.
Huh. When all you have is a harquebus ..
Recall what's needed: someone who is able and willing would like to distribute a multi-module solution as a zip file. dmdz must provide a means to do so. Simple as that. The "able and willing" part is important - you don't need to cope with arbitrarily-formatted archives, you can impose people how the zip must be formatted. If you ask for them to provide a file called "main.d" in the root of the zip, then so be it if it reduces the size of dmdz by a factor of ten. Andrei
By restricting the format of the zip file a bit and moving the directory dmd gets run in, I might save 100 loc. Maybe.
Does adding main.d to root help with the run flag? It doesn't do anything for dmdz that I can see.
By introducing path2list et al into std.path or wherever (really, it is quite handy) and fixing basename and dirname, I could save 2 - 300 loc.
By removing piecemeal and getting rid of dmd flags, I could quit 2 - 300 loc plus the ANTLR modules. Except I find both of those features occasionally useful. Given the choice, I'd keep them.
