[phobos] next release (meaning of path)

Michel Fortin michel.fortin at michelf.com
Mon Jan 3 06:29:06 PST 2011


Le 2011-01-03 à 9:02, Steve Schveighoffer a écrit :

> I understand this, but it's rarely needed.  What would the string represent if 
> not a path?  My point was that, the most intuitive interface is to take a 
> string.  This looks very intuitive to me:
> 
> auto f = openFile("/my/filename");

I think one reason is that sometime you have a constructor that takes either a path or a string. For instance, I could have a class TextContent that can be initialized wither with a path to a text file, or a string for the content. To implement this I need Path to be of a different type, or I need to introduce a dummy parameter. And it's not like I can give a different name to one of those constructors, all constructors have the same name in D.

There was a discussion about this on d.learn recently, so it's not like it's a made up case. (See "discrimination of constructors with same number of parameters", December 30.)

That said, I agree that generally using a path struct everywhere would be too verbose.


-- 
Michel Fortin
michel.fortin at michelf.com
http://michelf.com/





More information about the phobos mailing list