[Issue 12544] Differences in ubyte/char enum printing
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Tue Apr 8 06:55:12 PDT 2014
https://d.puremagic.com/issues/show_bug.cgi?id=12544
monarchdodra at gmail.com changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |monarchdodra at gmail.com
--- Comment #1 from monarchdodra at gmail.com 2014-04-08 06:54:41 PDT ---
The code goes through the "formatRange" branch of `std.format`.
In format range, the code checks if it is a range of chars:
- range of chars => print string (eg: aaaaaaa...)
- range of non-chars => print array (eg: [A, A, A, A, A...
The issue is one of determining "what is a char"?
Currently, the code uses:
is(CharTypeOf!(ElementType!T))
Which mean any type that implicitly casts to char is fair game (including
structs with "alias this").
*Arguably*, I think `isSomeChar` would be better, as it only accepts *actual*
chars.
But even then, it would still accept enums whose base type is char, as
technically, they *are* chars.
Unfortunately, there is always ambiguity when asking to print an enum of a char
or string.
I don't know either if this is bug or working as designed. (I don't think it's
a regression though... did you test other versions?)
--
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list