Thread overview
[Issue 3012] New: string.format is broken
May 20, 2009
davidl@126.com
May 20, 2009
Gide Nwawudu
May 20, 2009
david
[Issue 3012] bad diagnose miss use std.string.format
May 20, 2009
david
[Issue 3012] Bad error message when using string.format instead of std.string.format
May 20, 2009
Gide Nwawudu
Oct 20, 2012
Andrej Mitrovic
May 20, 2009
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
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




--- Comment #1 from Gide Nwawudu <gide@nwawudu.com>  2009-05-20 05:06:34 PDT ---
> 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
http://d.puremagic.com/issues/show_bug.cgi?id=3012





--- Comment #2 from david <davidl@126.com>  2009-05-20 06:21:35 PDT ---
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
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




--- Comment #3 from david <davidl@126.com>  2009-05-20 10:51:59 PDT ---
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
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




--- Comment #4 from Gide Nwawudu <gide@nwawudu.com>  2009-05-20 14:54:03 PDT ---
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: -------
October 20, 2012
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


--- Comment #5 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2012-10-20 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: -------