From: Beman Dawes (bdawes_at_[hidden])
Date: 2002-03-21 13:09:29
At 03:01 AM 3/21/2002, Dylan Nicholson wrote:
> --- Beman Dawes <bdawes_at_[hidden]> wrote:
>> I understand each of your points above; indeed my first cut looked a
>> like what you are describing. Here is why the header evolved:
>I do accept and see some benefit in the method you've chosen, but the
>"arbritrariness" of the names I guess is what worries me the most. It's
>much harder to think up long descriptive names that accurately capture
>intent. create_missing_directories probably stands out for that
>reason - what missing directories? And does it fail if there are
>no directories to create? etc.
I'm not so worried with create_directory/create_missing_directories as
remove/prune and copy.
Two names I can live with.
But with remove/prune, there end up being something like 7 names, and many
of those have several overloads. Minimum 13 signatures in all, and that
doesn't even cover a few of the behavior corner cases.
An alternative would be to have a single name ("remove") with four
signatures (unfiltered, filtered by name, filtered by regex, filtered by
Predicate). All would take an options argument, which would be a bitmask
type (126.96.36.199.2) with the following entries (I haven't tried to pick names
* OK if !exist(path) [otherwise throw if !exist(path)]
* recurse into subdirectories [otherwise don't recurse]
* error if !is_directory(path), or,
error if !is_file(path),
[otherwise can be either file or directory]
* remove path itself if filter results in is_empty_directory(path)
[otherwise filtered functions on dirs apply to contests only]
Dropping from 7 names to 1, and 13 signatures to 4 is certainly attractive.
Food for thought.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk