[Issue 4527] New: writeln/typeid to use string type names

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Jul 28 14:58:23 PDT 2010


http://d.puremagic.com/issues/show_bug.cgi?id=4527

           Summary: writeln/typeid to use string type names
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: Phobos
        AssignedTo: nobody at puremagic.com
        ReportedBy: bearophile_hugs at eml.cc


--- Comment #0 from bearophile_hugs at eml.cc 2010-07-28 14:58:21 PDT ---
This is a D2 program:

import std.stdio: writeln;
void main() {
    writeln(typeid(string));
    writeln(typeid(wstring));
    writeln(typeid(dstring));
}


I'd like the output of that program to be:

string
wstring
dstring

Instead of (dmd 2.047):

immutable(char)[]
immutable(wchar)[]
immutable(dchar)[]


"immutable(dchar)[]" is less readable, and dstring is a standard built-in alias
in D2.

Making them readable is especially important when string types are inside more
complex types, to decrease the visual noise a lot. Example:

import std.stdio;
void main() {
    wstring[string[dstring]] a;
    writeln(typeid(typeof(a)));
}

Prints an unreadable:
immutable(wchar)[][const(immutable(char)[])[immutable(dchar)[]]]

While this is almost readable still:
wstring[string[dstring]]


See also bug 3086

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list