
Rob Stewart wrote:
From: "Peter Dimov" <pdimov@mmltd.net>
Beman Dawes wrote:
"Peter Dimov" <pdimov@mmltd.net> wrote in message news:005701c55008$0eacc010$6401a8c0@pdimov2...
Rob Stewart wrote:
I don't like the status()/symlink_status() split. How about overloading like this:
struct follow_symlink_t { }; extern const follow_symlink_t follow_symlink;
status_flags status(path const &); status_flags status(path const &, follow_symlink_t);
FWIW, I'm in favor of the current design.
Rationale?
I don't view overloading for overloading's sake as improvement; there's nothing wrong with giving different names to different behaviors.
These functions do very nearly the same thing. That seems an ideal case for overloading.
This particular case is on the fence. One could think of the overloaded interface as a typesafe approximation of status_return_flags status( path const & p, status_option_flags flags = status_option_default ); with follow_symlink being the only option flag at the moment. In general, though, excessive overloading should be avoided. My usual litmus test for appropriate overloading is: can you tell what this does: f( x, y ); without looking up the exact types of x and y.