Thread overview
[Issue 6559] New: [CTFE-ish] Inconsistent array formatting at runtime vs compiletime
Aug 26, 2011
Nick Sabalausky
Aug 29, 2011
Don
[Issue 6559] Compiler message expression formatting does not match phobos
Jan 28, 2012
yebblies
Dec 28, 2012
Andrej Mitrovic
Dec 28, 2012
Walter Bright
Dec 28, 2012
Kenji Hara
August 26, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6559

           Summary: [CTFE-ish] Inconsistent array formatting at runtime vs
                    compiletime
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Severity: minor
          Priority: P2
         Component: DMD
        AssignedTo: nobody@puremagic.com
        ReportedBy: cbkbbejeap@mailinator.com


--- Comment #0 from Nick Sabalausky <cbkbbejeap@mailinator.com> 2011-08-26 11:30:41 PDT ---
> type testArrayOut.d
import std.stdio;
immutable arr = [ 1 , 2 , 3 ];
void main()
{
        pragma(msg, arr);
        writeln(arr);
}

> dmd testArrayOut.d
[1,2,3]

> testArrayOut
[1, 2, 3]

The formatting should be the same at both runtime and compile-time.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
August 29, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6559


Don <clugdbug@yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |clugdbug@yahoo.com.au


--- Comment #1 from Don <clugdbug@yahoo.com.au> 2011-08-29 00:51:37 PDT ---
(In reply to comment #0)
> > type testArrayOut.d
> import std.stdio;
> immutable arr = [ 1 , 2 , 3 ];
> void main()
> {
>         pragma(msg, arr);
>         writeln(arr);
> }
> 
> > dmd testArrayOut.d
> [1,2,3]
> 
> > testArrayOut
> [1, 2, 3]
> 
> The formatting should be the same at both runtime and compile-time.

You're assuming that pragma(msg) and writeln use the same format, but I'm not
sure why. AFAIK there is nothing in the spec that should give that impression.
They are completely unrelated features.
pragma(msg) uses the same format that is used for error messages.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
January 28, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=6559


yebblies <yebblies@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|CTFE                        |diagnostic
                 CC|                            |yebblies@gmail.com
           Platform|Other                       |All
            Summary|[CTFE-ish] Inconsistent     |Compiler message expression
                   |array formatting at runtime |formatting does not match
                   |vs compiletime              |phobos
         OS/Version|Windows                     |All
           Severity|minor                       |enhancement


--- Comment #2 from yebblies <yebblies@gmail.com> 2012-01-28 18:22:15 EST ---
I agree with Don.  This is asking for dmd's value formatting to match what phobos currently does.  The fact it doesn't is not a bug.  Does not involve CTFE.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
December 28, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=6559


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

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


--- Comment #3 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2012-12-27 17:55:28 PST ---
Incidentally it seems to be fixed:

D:\dev\code\d_code>rdmd test.d
[1, 2, 3]  -- CT
DMD v2.061 DEBUG
[1, 2, 3]  -- RT

It really is invalid to ask CT pragma to match Phobos formatters.

Note however that the new format in 2.061 works at compile-time, therefore you can have a 100% match if you use it in a pragma:

import std.stdio;
import std.string;
immutable arr = [ 1 , 2 , 3 ];
void main()
{
    pragma(msg, format("%s", arr));
}

In 2.060 you can use xformat instead.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
December 28, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=6559


Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|FIXED                       |WORKSFORME


--- Comment #4 from Walter Bright <bugzilla@digitalmars.com> 2012-12-27 21:10:29 PST ---
"seems to be fixed" should be resolves as "WORKSFORME".

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
December 28, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=6559



--- Comment #5 from Kenji Hara <k.hara.pg@gmail.com> 2012-12-27 23:33:41 PST ---
(In reply to comment #3)
> Incidentally it seems to be fixed:
> 
> D:\dev\code\d_code>rdmd test.d
> [1, 2, 3]  -- CT
> DMD v2.061 DEBUG
> [1, 2, 3]  -- RT
> 
> It really is invalid to ask CT pragma to match Phobos formatters.

As a side note, this change is introduced by fixing issue 2273.

https://github.com/D-Programming-Language/dmd/commit/04891ca1e554d46be873ebe607ddeb614d934e57

An array literal formatting in CT uses argsToCBuffer in expression.c, and it is also used for ddoc formatting.

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