On 03/18/2010 11:28 AM, Ellery Newcomer wrote:
On 03/17/2010 08:49 PM, Andrei Alexandrescu wrote:
The idea is to not extract the files every time you build. If they are
in place already, the tool should recognize that.

It does that, but on a per-file basis.

My bad for not being able to see that in the code. I read through and also searched for "cache", "date", "time"... couldn't find it. I now find it by looking for "last".

I'm not contending the tool is not useful. I'm just saying it is too big
for what it does, and that that does matter with regard to distributing
it with dmd.


I still don't see why (other than lexd.g adds ~ 10k loc just to get the
line 'module foo.bar;' out of a source file)

If a casual user downloads the dmd distro and says, hey, let me see how this rdmd tool is implemented, I wouldn't be afraid. If they take a look at dmdz, they may be daunted.

The example you gave is perfect. Right now rdmd runs dmd -v to figure out dependencies, but before it was parsing the file for lines that begin with "import". That was problematic, so I'm glad I now use the compiler. Your task is much simpler - nothing is allowed before the module line aside from the shebang line and comments, and you should feel free to restrict modules to e.g. not include recursive comments or anything that aggravates your job.

So, I'm very glad you mentioned it: 10K of code to detect "module" is absolute overkill. I now confess that I couldn't figure out why you needed the lexer for dmdz and didn't have the time to sift through the code and figure that out. I thought there must be some solid reason, and so I was ashamed to even ask. I did know you want to find "module", but in my naivete, I wasn't thinking that just that would ever inspire you to include a lexer.

To be frank, I even think you shouldn't worry at all about "module". Just extract the blessed thing with caching and call it a day. I was also thinking of simplifying options etc. by requiring a file "dmdflags.txt" in the archive and then do this when you run dmd:

dmd `cat dmdflags.txt` stuff morestuff andsomemorestuff

i.e. simply expand the file in the command line. No need for any extravaganza. But even dmdflags.txt I'd think would be a bit much. And speaking of cmdline stuff, assume find, zip, etc. are present on the host system if you need them.

BTW Walter made a very nice suggestion: make a .zip file in the command
line be equivalent to listing all files in that zip in the command line.
I think it's this kind of idea that greatly simplifies things.


Andrei

Fair enough.

Thank you for considering changing your program.


Andrei

Reply via email to