Re: Why are enums with base type string not considered strings?

2021-03-16 Thread wolframw via Digitalmars-d-learn

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



Re: Why are enums with base type string not considered strings?

2021-03-14 Thread Bastiaan Veelo via Digitalmars-d-learn

On Sunday, 14 March 2021 at 16:09:39 UTC, Imperatorn wrote:

On Sunday, 14 March 2021 at 10:42:17 UTC, wolframw wrote:

enum BoolEnum   : bool   { TestBool   = false }
enum CharEnum   : char   { TestChar   = 'A' }
enum StringEnum : string { TestString = "Hello" }

pragma(msg, isBoolean!BoolEnum);   // true
pragma(msg, isSomeChar!CharEnum);  // true
pragma(msg, isSomeString!StringEnum);  // false

Why does isSomeString not return true for an enum with base 
type string


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.


Re: Why are enums with base type string not considered strings?

2021-03-14 Thread Imperatorn via Digitalmars-d-learn

On Sunday, 14 March 2021 at 10:42:17 UTC, wolframw wrote:

enum BoolEnum   : bool   { TestBool   = false }
enum CharEnum   : char   { TestChar   = 'A' }
enum StringEnum : string { TestString = "Hello" }

pragma(msg, isBoolean!BoolEnum);   // true
pragma(msg, isSomeChar!CharEnum);  // true
pragma(msg, isSomeString!StringEnum);  // false

Why does isSomeString not return true for an enum with base 
type string while
other isX functions return true for enums with an according 
base type X?
Regarding whether enums should be considered by these 
functions, I can see the
case being made one of both ways (personally, I'd say they 
should), but in the

example above it seems that different rules are applied.


May be a regression?

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