[phobos] next release (meaning of path)
Steve Schveighoffer
schveiguy at yahoo.com
Mon Jan 3 06:38:50 PST 2011
The path still isn't at the same level as the content, it's an address to the
content. Only passing in path seems limited, what if you wanted a network
stream?
Now, a URI might pose a different argument, because it encodes how to open the
content as well as the path to the content, and it would seem complex to require
someone to open a network stream with a URI before passing it into a function.
However, I'd still be hesitant to suggest having the overload be against a URI
type. The main purpose of such types is to parse a string into its components,
not to provide an overload mechanism. It seems incorrect to use these types of
things as parameters to distinguish them from strings.
-Steve
----- Original Message ----
> From: Michel Fortin <michel.fortin at michelf.com>
> To: Discuss the phobos library for D <phobos at puremagic.com>
> Sent: Mon, January 3, 2011 9:29:06 AM
> Subject: Re: [phobos] next release (meaning of path)
>
> 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/
>
>
>
> _______________________________________________
> phobos mailing list
> phobos at puremagic.com
> http://lists.puremagic.com/mailman/listinfo/phobos
>
More information about the phobos
mailing list