dmdfind

Georg Wrede georg.wrede at iki.fi
Mon Mar 9 17:30:36 PDT 2009


Sometimes one remembers a function name or something else, but not where 
it is documented. Wouldn't it be nice to be able to do something like

$ dmdfind typeinfo

and simply get a list of the files where it is mentioned.

The output might be something like what one gets with

$ grep -il typeinfo /usr/local/digitalmars/dmd2026/html/d/*.html
changelog.html
expression.html
function.html

Of course, every seasoned D programmer already has something like this 
set up, right? But for others it would be very nice to get used to using 
this from the start. (I remember spending sometimes a lot of time 
searching for things. And sometimes I find myself googling around for 
things, instead of looking at local dmd files.)

So, I got a suggestion: why not have a little program with the other 
binaries, that outputs this info? Something like:

dmdfind [option] word [word...]
   --html     search in dmd html documents (the default)
   --browse   same as --html, except opens browser into the files
   --dmd      search in dmd source code
   --druntime search in druntime source code
   --phobos   search in phobos source
   --version
   --modules  list importable modules

Of these, --html would have the same output as the grep line I mentioned 
above. --dmd would search for definitions for functions, etc. in the dmd 
compiler source. Likewise --druntime and --phobos. --modules would 
simply list all importable modules. (--version and --modules don't take 
arguments.)

---------

This is just an idea. Is this any good? And what should such a program 
do? My suggestion above is simply an idea, so far.

This could, of course, be simply a shell script, or it could be a real D 
program a la rdmd.

Done right, it would not even have to be recompiled for every dmd 
version, only when something fundamental changes.



More information about the Digitalmars-d mailing list