
"Peter Dimov" <pdimov@mmltd.net> wrote in message news:00a201c55418$585bb2c0$6401a8c0@pdimov2...
Beman Dawes wrote:
A hypothetical OS that allows directories to be opened with an ifstream may reasonably answer true to both is_stream(p) and is_directory(p). Or maybe not. :-)
I think not. Dividing the world into non-overlapping categories is much easier:-)
It's only easier until an example comes up that doesn't fit the scheme, so you are forced to invent meta-categories (also known as "hacks" in some category theory circles) such as "other". :-)
"Capability bits" are cleaner. Is it openable with ifstream? file_bit. Is it iteratable with directory_iterator? directory_bit. Does it exist? !not_found_bit.
I'm only partially convinced. How useful is knowing that you can ifstream a directory? The only cases I can think of are so system specific that I have trouble seeing them in the context of Boost.Filesystem.
When a socket is thrown your way, you just run it by the list and conclude that no bit needs to be set.
But that is about the same as having an other_flag, except that the name is 0 instead of other_flag. Giving it a name makes it more obvious that a return from status() may not have any of the other bits set --Beman