September 26, 2004

I think a useful addition to command shells would be pronouns. So you could do stuff like this:

    % grep ’main(’ *.c
    grid.c: int main()
    % vi $it

and that would edit the file the string was found in. Or:

    % grep ’printf’ *.c
    grid.c:    printf(“Usage: grid <file>\n”);
    util.c:    printf(“Can’t find input file.\n”);
    % vi $them

to edit them all. This could also be used to narrow down a search:

    % grep ’<script’ *.html
    (... a bunch of files ...)
    % grep ’<style’ $them

This would find files that have both script and style tags (but not necessarily on the same line). Each program would return both a list of hits and a single hit to bind to $them and $it respectively. Here you’d have to make some guesses as to what the user was interested in. For example, if the user typed:

    % ls -lt
    (... a bunch of files sorted by time ...)
    % vi $it

they probably want to edit the most recent file, since they sorted the directory by time. (That may not be right, they may want the oldest.) This might also be useful:

    % ls /usr/people/lawrence/incoming
    % cp disk.config $there

In general it seems that natural languages use pronouns all the time, but computer languages don’t. Maybe the possibility of ambiguity scares language designers away.

Speaking of ambiguity and pronouns: In romance novels they have passages that read something like, “He moved his hand up her thigh and she moaned in pleasure” or whatever. How do they write those passages in gay romance novels? Are they more annoying to read because the characters’ names are repeated all the time?