November 08, 2012
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
> > at the method parse:
> > Error: URI class literals cannot be returned from CTFE
> 
> It looks like you can't have class enums. This fails too:
> 
> class A{}
> enum a = new A;
> 
> I don't think you can get around this

Nope. To some extent, classes can be used at compile time, but they can't persist from compile time to runtime. So, if you really want a type which is useable with CTFE, make it a struct, not a class.

- Jonathan M Davis
November 09, 2012
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.
>> > Instead, when I call parse on compile time I get the following
>> > at the method parse:
>> > Error: URI class literals cannot be returned from CTFE
>> 
>> It looks like you can't have class enums. This fails too:
>> 
>> class A{}
>> enum a = new A;
>> 
>> I don't think you can get around this
>
> Nope. To some extent, classes can be used at compile time, but they can't
> persist from compile time to runtime. So, if you really want a type which is
> useable with CTFE, make it a struct, not a class.
>
> - Jonathan M Davis

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 of a class. But then I won't be able to return null anymore so I should throw an exception when an invalid URI has been passed to the constructor.

November 09, 2012
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 of a class. But then I won't be able to return null anymore so I should throw an exception when an invalid URI has been passed to the constructor.s

Sure. I see no problem with throwing an exception when a constructor is given invalid data. std.datetime does that with its types.

- Jonathan M Davis
February 24, 2013
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. :)
1 2 3 4 5 6
Next ›   Last »