www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 9547] New: typeof() which requires .init must be properly documented

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

           Summary: typeof() which requires .init must be properly
                    documented
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: spec
          Severity: regression
          Priority: P2
         Component: websites
        AssignedTo: nobody puremagic.com
        ReportedBy: andrej.mitrovich gmail.com



20:46:48 PST ---
import std.range;

void getArray(T)()
{
    alias ElementType!T ElemType1;  // OK
    alias typeof(T[0]) ElemType2;   // NG
}

void main()
{
    getArray!(string[])();
}

This worked in 2.061, and broke LuaD in 2.062. The workaround (or rather the
new valid code) is:

alias typeof(T.init[0]) ElemType;

However this change *must* be clearly documented in the changelog, and the
requirement should be part of the documentation somewhere.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 19 2013
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9547


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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|regression                  |normal


-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 19 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9547




20:50:43 PST ---

 However this change *must* be clearly documented in the changelog, and the
 requirement should be part of the documentation somewhere.
In addition to that we should change the error message, and perhaps even consider warning the user of a change. E.g. the current error:
 Error: argument string[][0u] to typeof is not an expression
It could be: Error: Cannot index into a type 'T[0u]', perhaps you meant 'T.init[0]' ? -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Feb 19 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9547





 This worked in 2.061, and broke LuaD in 2.062. The workaround (or rather the
 new valid code) is:
 
 alias typeof(T.init[0]) ElemType;
This is bug fix for issue 6408. `T[0]` should be always analyzed as "zero length static array of T", but it was *accidentally* treated as T.init[0].
 However this change *must* be clearly documented in the changelog, and the
 requirement should be part of the documentation somewhere.
I can agree that some of proper bug fixes require clear explanation for better migration. We need to pay attention for them in beta phase, and document them. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Feb 19 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9547




21:09:52 PST ---

 This is bug fix for issue 6408. `T[0]` should be always analyzed as "zero
 length static array of T", but it was *accidentally* treated as T.init[0].
Yeah I had a vague memory of this being fixed recently. It's a good change.
 I can agree that some of proper bug fixes require clear explanation for better
 migration. We need to pay attention for them in beta phase, and document them.
For the upcoming 2.063 release I suggest we keep a special text file (e.g. a local "changes" file in DMD git) where each language change is documented every time such a pull request is merged. This will make sure we never forget to document a language change (it is much harder to do this at the end when there are 150+ bugs fixed). -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Feb 19 2013
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9547


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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |WORKSFORME



16:01:49 PDT ---
Fixed in 2.063, we've had a good changelog for it.

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