www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 3012] New: string.format is broken

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3012

           Summary: string.format is broken
           Product: D
           Version: 2.028
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: davidl 126.com


testd:
import std.string;

void main()
{
string s= string.format("abc","abc");
}

TypeExp::toElem()
testd.d(5): Error: type immutable(char)[] is not an expression

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 20 2009
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3012


Gide Nwawudu <gide nwawudu.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |gide nwawudu.com
         Resolution|                            |INVALID





 string s= string.format("abc","abc");
Shouldn't that be std.string.format? I think what is written is equalivent to; format(string,"abc","abc"); import std.string; void main() { string s = std.string.format("abc","abc"); //OK // -or- string s1 = format("abc","abc"); //OK } -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
May 20 2009
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3012






err.. i didn't figure out the real meaning of that error message..

Maybe it'd better tell me in what context I did wrong.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 20 2009
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3012


david <davidl 126.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|INVALID                     |
            Summary|string.format is broken     |bad diagnose miss use
                   |                            |std.string.format
           Severity|normal                      |enhancement





I change this bug to enhancement request for better diagnose.

TypeExp::toElem()   //redundent
testd.d(5): Error: type immutable(char)[] is not an expression     

// not clear enough for one to figure out it rewrites it to format(string,
"abc", "abc");  At least for me in this case. I don't think D newbies can
easily get the idea of this error message correctly.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 20 2009
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3012


Gide Nwawudu <gide nwawudu.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |diagnostic
            Summary|bad diagnose miss use       |Bad error message when
                   |std.string.format           |using string.format instead
                   |                            |of std.string.format





Agreed it is confusing. I've changed title and added diagnostic keyword.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 20 2009
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3012


Andrej Mitrovic <andrej.mitrovich gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |RESOLVED
                 CC|                            |andrej.mitrovich gmail.com
         Resolution|                            |FIXED



10:00:26 PDT ---
Error is now:
test.d(5): Error: no property 'format' for type 'string'

This is clear enough now.

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