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.