Why are enums with base type string not considered strings?

wolframw wolframw at protonmail.com
Tue Mar 16 21:58:07 UTC 2021


On Sunday, 14 March 2021 at 16:30:47 UTC, Bastiaan Veelo wrote:
> On Sunday, 14 March 2021 at 16:09:39 UTC, Imperatorn wrote:
>> On Sunday, 14 March 2021 at 10:42:17 UTC, wolframw wrote:
>>> [...]
>>
>> May be a regression?
>>
>> https://issues.dlang.org/show_bug.cgi?id=16573
>
> Indeed: https://run.dlang.io/is/liSDBZ
>
> It regressed in 2.079.1. Seems to be worth an issue report.
>
> —Bastiaan.

Thanks for the advice. I've since had a deeper look into this 
located the PR
that changed this behavior [1]. It seems this change was very 
much deliberate.
In the PR, Jonathan also makes some points that are very hard to 
disagree with.
So, perhaps the better solution would be to make isBoolean and 
isSomeChar (and
perhaps other functions that I didn't think of) return false for 
enums?

As a side note, isSomeChar returning true for enums is also what 
causes the
behavior demonstrated in Issue 21639 [2].

[1] https://github.com/dlang/phobos/pull/5291
[2] https://issues.dlang.org/show_bug.cgi?id=21639



More information about the Digitalmars-d-learn mailing list