
Andre Merzky wrote:
Quoting [Ceriel Jacobs] (Aug 17 2009):
Andre Merzky wrote:
You are right: open should be able to open entries and directories (which *are* entries). open_dir should work only for directories. Same holds then indeed for the entry and dir constructors. Are you sure? I have an issue with what you are saying about the entry constructor. I think that if a ns_entry object represents a directory, it should in fact be a ns_directory object.
Well, directory inherits entry, so you can alw2ays do:
saga::url u ("file://localhost/etc/") saga::file::dir d (u); saga::file::entry e = d; // downcast should always work
Yes, but upcast does not. My point is that the ns_entry constructor cannot create a ns_directory. It is a constructor, after all.
If the above works, I don't see why
saga::file::entry e (u);
should not work. Or am I missing something? The same then also holds for the open methods - the origin of Matijs' complain.
It is a major semantics change. If you do that, all methods in the ns_entry implementations now have to consider the possibility that the entry in fact is a directory, whereas earlier they could just be hidden by ns_directory implementations. Also, I think it is confusing that you can have a ns_entry object that represents a directory but cannot be casted to a ns_directory. Note that I don't have an issue with the change in the ns_directory.open method, only with the change in the ns_entry constructor which, being a constructor, cannot deliver a ns_directory. Cheers, Ceriel