[Issue 16573] string-typed enum values pass isSomeString but not isInputRange

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Sun Oct 2 08:23:52 PDT 2016


https://issues.dlang.org/show_bug.cgi?id=16573

--- Comment #3 from Jonathan M Davis <issues.dlang at jmdavisProg.com> ---
(In reply to ryan from comment #2)
> > Personally, I'm surprised that isSomeString works with an enum
> 
> Well, you did merge the PR that made it so :)
> https://github.com/dlang/phobos/pull/739

Oh, lovely. Well, we all make stupid decisions from time to time, and this
situation is a bit sticky either way, since some code really doesn't care about
whether it's dealing with a string on an enum, but in general, if a conevrsion
isn't forced to the base type, generic code is going to have problems whenever
it's dealing with an implicit conversion rather.

What's so weird about that whole thing though was that I was so sure that at
one point, we changed those traits to be true for enums and then decided that
it was a horrible idea and changed them back. So, I really don't know what
happened.

> I agree that the simplest and most consistent solution is just reverting
> that, but it seems like a deliberate decision.
> Either way it sounds like isConvertibleToString should return true though.
> While we're at it, isConvertibleToString should either be documented or made
> private. What do you think?

I don't know why it's not properly documented. It seems like it should be. I'm
inclined to think that we should fix it to be true for enums, but that does get
a bit weird when combined with the fact that isSomeString would also be true in
that case.

--


More information about the Digitalmars-d-bugs mailing list