Re: Uri class and parser

2013-02-24 Thread RommelVR
Any word on the review process for this? For now I have been using it in my projects by just putting it in std/net on its own. But I'd obviously like to see it in the standard library some down, as its URI parsing is very valuable. :)

Re: Uri class and parser

2012-11-08 Thread Jonathan M Davis
On Friday, November 09, 2012 01:16:54 Mike van Dongen wrote: > Then I shall make it a struct. But is the following acceptable in > phobos? > > On Thursday, 8 November 2012 at 15:10:18 UTC, Mike van Dongen > > wrote: > > I agree with Jens Mueller on the fact that URI should be a > > struct instead

Re: Uri class and parser

2012-11-08 Thread Mike van Dongen
On Thursday, 8 November 2012 at 23:51:47 UTC, Jonathan M Davis wrote: On Friday, November 09, 2012 00:42:42 jerro wrote: > After trying your solution I found out I was calling > indexOf(string, char) which apparently is different than > indexOf(string, string) as I now no longer have that error.

Re: Uri class and parser

2012-11-08 Thread Jonathan M Davis
On Friday, November 09, 2012 00:42:42 jerro wrote: > > After trying your solution I found out I was calling > > indexOf(string, char) which apparently is different than > > indexOf(string, string) as I now no longer have that error. > > Instead, when I call parse on compile time I get the following

Re: Uri class and parser

2012-11-08 Thread jerro
After trying your solution I found out I was calling indexOf(string, char) which apparently is different than indexOf(string, string) as I now no longer have that error. Instead, when I call parse on compile time I get the following at the method parse: Error: URI class literals cannot be retur

Re: Uri class and parser

2012-11-08 Thread Mike van Dongen
On Thursday, 8 November 2012 at 17:02:25 UTC, jerro wrote: Thnx. Got myself some new errors ;) It seems that std.string.indexOf() does not work at compile time. Is there a solution or alternative method for this? I guess the proper solution would be to make std.string.indexOf work at compile

Re: Uri class and parser

2012-11-08 Thread jerro
Thnx. Got myself some new errors ;) It seems that std.string.indexOf() does not work at compile time. Is there a solution or alternative method for this? I guess the proper solution would be to make std.string.indexOf work at compile time. It looks like changing the first if (std.ascii.isASC

Re: Uri class and parser

2012-11-08 Thread Mike van Dongen
On Thursday, 8 November 2012 at 15:32:59 UTC, jerro wrote: Something entirely else is the CTFE compatibility of URI. At first I though that because a new instance of URI can be created as a const, it would be evaluated on compile time. This is part of how I test CTFE at the moment: const URI u

Re: Uri class and parser

2012-11-08 Thread jerro
Something entirely else is the CTFE compatibility of URI. At first I though that because a new instance of URI can be created as a const, it would be evaluated on compile time. This is part of how I test CTFE at the moment: const URI uri36 = URI.parse("http://dlang.org/";); assert(uri36.scheme

Re: Uri class and parser

2012-11-08 Thread Mike van Dongen
Been thinking about this for a while now, but I can't decide which one I should choose. Currently there is a class URI which has an static method (parser) which returns an instance of URI on success. On failure it will return null. I agree with Jens Mueller on the fact that URI should be a s

Re: Uri class and parser

2012-10-28 Thread Jacob Carlborg
On 2012-10-28 12:39, Jonathan M Davis wrote: I don't know everything that he's basing it on, but we've definitely had complaints in this newsgroup in the past over breaking changes (and it wouldn't surprise me if the folks in this newsgroup are more willing to put up with breaking changes than m

Re: Uri class and parser

2012-10-28 Thread Jonathan M Davis
On Sunday, October 28, 2012 11:32:14 Jens Mueller wrote: > Walter Bright wrote: > > On 10/26/2012 2:13 AM, Jonathan M Davis wrote:> There's definitely > > some truth to that, but Walter in particular seems to be > > > > > against breaking anything period. > > > > We have a number of fed up develo

Re: Uri class and parser

2012-10-28 Thread Jens Mueller
Walter Bright wrote: > On 10/26/2012 2:13 AM, Jonathan M Davis wrote:> There's definitely > some truth to that, but Walter in particular seems to be > > against breaking anything period. > > We have a number of fed up developers and abandoned, dead projects > because of breaking changes. > > It M

Re: Uri class and parser

2012-10-27 Thread Jacob Carlborg
On 2012-10-26 22:20, Walter Bright wrote: n 10/23/2012 1:47 PM, Mike van Dongen wrote: > My code can be found here, at the bottom of the already existing file uri.d: > https://github.com/MikevanDongen/phobos/blob/uri-parser/std/uri.d Needs to have a range interface, not a string interface. F

Re: Uri class and parser

2012-10-27 Thread Jacob Carlborg
On 2012-10-26 16:16, Jens Mueller wrote: Probably. I'm all for it. The thing is that new things are proposed but these then die out quickly. I have that feeling e.g. with trello.com even though it's a good idea. I wish I knew why these things do not work out. But there are also decisions that tu

Re: Uri class and parser

2012-10-26 Thread Adam D. Ruppe
On Friday, 26 October 2012 at 20:20:59 UTC, Walter Bright wrote: Needs to have a range interface, not a string interface. I don't think range makes any sense for this. It isn't something you'd loop over... you just load the one string and slice it up.

Re: Uri class and parser

2012-10-26 Thread Walter Bright
On 10/26/2012 2:13 AM, Jonathan M Davis wrote:> There's definitely some truth to that, but Walter in particular seems to be > against breaking anything period. We have a number of fed up developers and abandoned, dead projects because of breaking changes. It MUST STOP.

Re: Uri class and parser

2012-10-26 Thread Walter Bright
n 10/23/2012 1:47 PM, Mike van Dongen wrote: > My code can be found here, at the bottom of the already existing file uri.d: > https://github.com/MikevanDongen/phobos/blob/uri-parser/std/uri.d Needs to have a range interface, not a string interface.

Re: Uri class and parser

2012-10-26 Thread Mike van Dongen
On Friday, 26 October 2012 at 14:22:07 UTC, Adam D. Ruppe wrote: On Friday, 26 October 2012 at 14:13:21 UTC, Mike van Dongen wrote: I am however considering it because even though not (clearly) defined, they are URIs and they are often used. The basedOn function in my uri struct in cgi.d does

Re: Uri class and parser

2012-10-26 Thread Adam D. Ruppe
On Friday, 26 October 2012 at 14:13:21 UTC, Mike van Dongen wrote: I am however considering it because even though not (clearly) defined, they are URIs and they are often used. The basedOn function in my uri struct in cgi.d does it: https://github.com/adamdruppe/misc-stuff-including-D-programmi

Re: Uri class and parser

2012-10-26 Thread Jens Mueller
Jacob Carlborg wrote: > On 2012-10-26 11:53, Jens Mueller wrote: > > >Unfortunately there are no portable solutions. The only thing I found is > >symbol versioning. But this is only supported by GNU ld. > >These strategic issues need to be solved. > > There are many other solutions that can be us

Re: Uri class and parser

2012-10-26 Thread Mike van Dongen
On Friday, 26 October 2012 at 11:52:09 UTC, John Chapman wrote: Looks good. Does it handle relative URIs? It would also be nice to support combining URIs from an absolute and relative portion. Another omission is handling file URIs. It doesn't support relative URIs as their syntax is not o

Re: Uri class and parser

2012-10-26 Thread John Chapman
Looks good. Does it handle relative URIs? It would also be nice to support combining URIs from an absolute and relative portion. Another omission is handling file URIs.

Re: Uri class and parser

2012-10-26 Thread Jacob Carlborg
On 2012-10-26 11:13, Jonathan M Davis wrote: There's definitely some truth to that, but Walter in particular seems to be against breaking anything period. If it were entirely up to him, pretty much none of the breaking changes that have happened to Phobos' API over the last few years would have

Re: Uri class and parser

2012-10-26 Thread Jacob Carlborg
On 2012-10-26 11:53, Jens Mueller wrote: Unfortunately there are no portable solutions. The only thing I found is symbol versioning. But this is only supported by GNU ld. These strategic issues need to be solved. There are many other solutions that can be used to easy this problem. The releas

Re: Uri class and parser

2012-10-26 Thread Jens Mueller
Jonathan M Davis wrote: > On Friday, October 26, 2012 11:27:40 Jens Mueller wrote: > > Is it okay to have both modules and only state in std.uri's > > documentation that you shouldn't use it anymore (similar to std.xml)? > > This would break no code. > > If we were to move it, we'd temporarily lea

Re: Uri class and parser

2012-10-26 Thread Jonathan M Davis
On Friday, October 26, 2012 11:27:40 Jens Mueller wrote: > Is it okay to have both modules and only state in std.uri's > documentation that you shouldn't use it anymore (similar to std.xml)? > This would break no code. If we were to move it, we'd temporarily leave a near-empty std.uri which publi

Re: Uri class and parser

2012-10-26 Thread Jens Mueller
Jonathan M Davis wrote: > On Friday, October 26, 2012 10:59:17 Jens Mueller wrote: > > > No. The issue is code breakage in the code of people using Phobos, and if > > > you change where the module is, you'll break code. Even if we provide a > > > deprecation path from std.uri to std.net.uri, that s

Re: Uri class and parser

2012-10-26 Thread Jonathan M Davis
On Friday, October 26, 2012 10:59:17 Jens Mueller wrote: > > No. The issue is code breakage in the code of people using Phobos, and if > > you change where the module is, you'll break code. Even if we provide a > > deprecation path from std.uri to std.net.uri, that still means that > > people will

Re: Uri class and parser

2012-10-26 Thread Jens Mueller
Jonathan M Davis wrote: > On Friday, October 26, 2012 10:11:04 Jens Mueller wrote: > > Jacob Carlborg wrote: > > > On 2012-10-25 23:06, Jens Mueller wrote: > > > >I'd prefer the second option. Maybe write first some unittests for > > > >std.uri, if there are none. Then move it. > > > > > > Agree,

Re: Uri class and parser

2012-10-26 Thread Jonathan M Davis
On Friday, October 26, 2012 10:11:04 Jens Mueller wrote: > Jacob Carlborg wrote: > > On 2012-10-25 23:06, Jens Mueller wrote: > > >I'd prefer the second option. Maybe write first some unittests for > > >std.uri, if there are none. Then move it. > > > > Agree, but we want to minimize the code break

Re: Uri class and parser

2012-10-26 Thread Jens Mueller
Jacob Carlborg wrote: > On 2012-10-25 23:06, Jens Mueller wrote: > > >I'd prefer the second option. Maybe write first some unittests for > >std.uri, if there are none. Then move it. > > Agree, but we want to minimize the code breakage. That's what the unittests are for. Code breakage that result

Re: Uri class and parser

2012-10-25 Thread Jacob Carlborg
On 2012-10-25 23:06, Jens Mueller wrote: I'd prefer the second option. Maybe write first some unittests for std.uri, if there are none. Then move it. Agree, but we want to minimize the code breakage. -- /Jacob Carlborg

Re: Uri class and parser

2012-10-25 Thread Jens Mueller
Jonathan M Davis wrote: > On Thursday, October 25, 2012 23:05:14 Jens Mueller wrote: > > Jonathan M Davis wrote: > > > On Thursday, October 25, 2012 15:59:39 Jens Mueller wrote: > > > > * Should URIs be only movable? Then you should add > > > > @disable this(this); > > > > > > I'd be shocked if th

Re: Uri class and parser

2012-10-25 Thread Jonathan M Davis
On Thursday, October 25, 2012 23:05:14 Jens Mueller wrote: > Jonathan M Davis wrote: > > On Thursday, October 25, 2012 15:59:39 Jens Mueller wrote: > > > * Should URIs be only movable? Then you should add > > > @disable this(this); > > > > I'd be shocked if that were appropriate. Disabling the ini

Re: Uri class and parser

2012-10-25 Thread Jens Mueller
Mike van Dongen wrote: > On Thursday, 25 October 2012 at 13:59:59 UTC, Jens Mueller wrote: > >Just some small nit-picks. > > That's what I was hoping for :D > > > > in general checkout the Phobos style guide regarding function > >names > > etc. > > http://dlang.org/dstyle.html > > > add som

Re: Uri class and parser

2012-10-25 Thread Jens Mueller
Jacob Carlborg wrote: > On 2012-10-25 15:20, Mike van Dongen wrote: > > >It's a dirty job, but someone's gotta do it ;) > >I have commented all code that's not straightforward, but nothing for > >the Ddoc. > > If think the ddoc is the most important one. > > >Can you give me an example of how sp

Re: Uri class and parser

2012-10-25 Thread Jens Mueller
Jonathan M Davis wrote: > On Thursday, October 25, 2012 15:59:39 Jens Mueller wrote: > > * Should URIs be only movable? Then you should add > > @disable this(this); > > I'd be shocked if that were appropriate. Disabling the init property like > that > should be done extremely rarely and only if

Re: Uri class and parser

2012-10-25 Thread Jacob Carlborg
On 2012-10-25 15:20, Mike van Dongen wrote: It's a dirty job, but someone's gotta do it ;) I have commented all code that's not straightforward, but nothing for the Ddoc. If think the ddoc is the most important one. Can you give me an example of how specific I need to be in the documentation

Re: Uri class and parser

2012-10-25 Thread Mike van Dongen
On Thursday, 25 October 2012 at 13:59:59 UTC, Jens Mueller wrote: Just some small nit-picks. That's what I was hoping for :D in general checkout the Phobos style guide regarding function names etc. http://dlang.org/dstyle.html add some unittests. Thanks! I haven't read that pag

Re: Uri class and parser

2012-10-25 Thread Jonathan M Davis
On Thursday, October 25, 2012 15:59:39 Jens Mueller wrote: > * Should URIs be only movable? Then you should add > @disable this(this); I'd be shocked if that were appropriate. Disabling the init property like that should be done extremely rarely and only if you need to. It's problematic that that

Re: Uri class and parser

2012-10-25 Thread Jens Mueller
Mike van Dongen wrote: > Hi all! > > I've been working on an URI parser which takes a string and then > separates the parts and puts them in the correct properties. > If a valid URI was provided, the (static) parser will return an > instance of Uri. > > I've commented all relevant lines of code a

Re: Uri class and parser

2012-10-25 Thread Mike van Dongen
On Wednesday, 24 October 2012 at 12:47:15 UTC, Adam D. Ruppe wrote: BTW don't forget that this is legal: ?value&value=1&value=2 The appropriate type for the AA is string[][string] Thanks for the type! It's now implemented. uri = Uri.parse("http://dlang.org/?value&value=1&value=2";); assert(

Re: Uri class and parser

2012-10-25 Thread Jacob Carlborg
On 2012-10-25 13:24, Mike van Dongen wrote: Now it allows you to create/edit an URI. You can do so by using an array or string, whichever you prefer. I also added a toString() method and fixed the indentation to 4 spaces, instead of 1 tab. uri = new Uri(); uri.scheme = "foo"; uri.username = "us

Re: Uri class and parser

2012-10-25 Thread Mike van Dongen
On Wednesday, 24 October 2012 at 20:36:51 UTC, Adam D. Ruppe wrote: On Wednesday, 24 October 2012 at 19:54:54 UTC, Jacob Carlborg wrote: A nitpick, I'm not really an expert on URI's but is "fragment" really the correct name for that I would call the "hash"? That would be "nose" in the example b

Re: Uri class and parser

2012-10-24 Thread Jacob Carlborg
On 2012-10-24 22:36, Adam D. Ruppe wrote: Yes, that's the term in the standard. http://en.wikipedia.org/wiki/Fragment_identifier Javascript calls it the hash though, but it is slightly different: the # symbol itself is not part of the fragment according to the standard. But javascript's locat

Re: Uri class and parser

2012-10-24 Thread Adam D. Ruppe
On Wednesday, 24 October 2012 at 19:54:54 UTC, Jacob Carlborg wrote: A nitpick, I'm not really an expert on URI's but is "fragment" really the correct name for that I would call the "hash"? That would be "nose" in the example below. Yes, that's the term in the standard. http://en.wikipedia.or

Re: Uri class and parser

2012-10-24 Thread Jacob Carlborg
On 2012-10-24 20:22, Mike van Dongen wrote: Thanks for the suggestions! I've added many, if not all, of them to the repo: - Identifying/separating the username, password (together the userinfo), the domain and the port number from the authority. - The hash now also can be get/set and the same t

Re: Uri class and parser

2012-10-24 Thread Mike van Dongen
On Wednesday, 24 October 2012 at 07:38:58 UTC, Jacob Carlborg wrote: I would have expected a few additional components, like: * Domain * Password * Username * Host * Hash A way to build an URI base on the components. It would be nice if there were methods for getting/setting the path component

Re: Uri class and parser

2012-10-24 Thread ponce
On Wednesday, 24 October 2012 at 07:38:58 UTC, Jacob Carlborg wrote: I would have expected a few additional components, like: * Domain * Password * Username * Host * Hash A way to build an URI base on the components. It would be nice if there were methods for getting/setting the path componen

Re: Uri class and parser

2012-10-24 Thread Adam D. Ruppe
On Wednesday, 24 October 2012 at 07:38:58 UTC, Jacob Carlborg wrote: It would be nice if there were methods for getting/setting the path component as an array. Also methods for getting/setting the query component as an associative array. BTW don't forget that this is legal: ?value&value=1&val

Re: Uri class and parser

2012-10-24 Thread Adam D. Ruppe
On Tuesday, 23 October 2012 at 20:47:26 UTC, Mike van Dongen wrote: https://github.com/MikevanDongen/phobos/blob/uri-parser/std/uri.d If you want to take any of the code from mine, feel free. It is struct Uri in my cgi.d: https://github.com/adamdruppe/misc-stuff-including-D-programming-langu

Re: Uri class and parser

2012-10-24 Thread Jacob Carlborg
On 2012-10-23 22:47, Mike van Dongen wrote: Hi all! I've been working on an URI parser which takes a string and then separates the parts and puts them in the correct properties. If a valid URI was provided, the (static) parser will return an instance of Uri. I've commented all relevant lines of