March 10, 2009dmdfind
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.
March 10, 2009Re: dmdfind
Posted in reply to Georg Wrede
"Georg Wrede" <firstname.lastname@example.org> wrote in message news:email@example.com... > 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 > Not a bad idea. I'm notoriously bad at memorization so I frequently find myself searching through the tango source to find something (often, I can find what I'm looking for through tango's website, but sometimes, for one reason or another, I end up needing to look through my copy of the tango src.) My only problem with this proposed dmdfind though, is that it sounds like little more than a less-generic version of the fairly standard "Find In Files" feature of many IDEs (like the one I use). And "Find In Files" could certainly be made into a command-line util which would be just like the "dmdfind" but more generic (I don't know enought about grep to know if it could be configured into doing this instead of just displaying the filenames as above). However, given a good command-line "Find In Files" tool, it would be very nice to have a wrapper for it that would automatically search whatever standard include directories you have set up for dmd (and optionally your current project as well, maybe by somehow being tied into rebuild or something).
Copyright © 1999-2016 by the D Language Foundation