www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 10325] New: ddoc: template constraints inconsistently shown in generated html

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

           Summary: ddoc: template constraints inconsistently shown in
                    generated html
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: thelastmammoth gmail.com



ddoc doesn't generate template constraints or does so very inconsistently :
in http://dlang.org/phobos/std_algorithm.html we have:
template map(fun...) if (fun.length >= 1);
but all other template constraints are omitted, eg:
void fill(Range, Value)(Range range, Value filler); // template constraint
omitted.

I originally reported this in
http://forum.dlang.org/post/mailman.1006.1370836279.13711.digitalmars-d puremagic.com.
In that link I also suggested a concise way to write those template
constraints.

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


bearophile_hugs eml.cc changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bearophile_hugs eml.cc





 ddoc doesn't generate template constraints or does so very inconsistently :
 in http://dlang.org/phobos/std_algorithm.html we have:
 template map(fun...) if (fun.length >= 1);
 but all other template constraints are omitted, eg:
 void fill(Range, Value)(Range range, Value filler); // template constraint
 omitted.
I suggest you to write here a little test case program that imports nothing from Phobos, usable as test case. It should cover various cases, to make it usable as test case for the person that will write the patch that fixes the bug. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jun 10 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10325


Jonathan M Davis <jmdavisProg gmx.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jmdavisProg gmx.com



PDT ---
It's my understanding that template constraints are never supposed to show up
in the docs, but right now, it does look they show up some of the time when
it's specifically a template in the docs rather than a function, and templated
functions do indeed not have template constraints on them in the docs.
Regardless, what's currently showing up in the docs is indeed inconsistent.

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


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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |andrej.mitrovich gmail.com



07:31:41 PDT ---
Test-case:

-----
module ddoc10325;

/** */
template templ(T...)
    if (someConstraint!T)
{
}

/** */
void foo(T)(T t)
    if (someConstraint!T)
{
}

void main() { }
-----

The constraints for 'foo' are not shown.

Constraints should be part of the documentation, they form part of the
interface. 

When a user gets an error about instantiating a template, he will get the name
of the template and its constraints, it only makes sense to also include the
constraints in the documentation.

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


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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ddoc, pull
         AssignedTo|nobody puremagic.com        |andrej.mitrovich gmail.com



07:51:07 PDT ---
https://github.com/D-Programming-Language/dmd/pull/2161

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




Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/3f9d50b12f9d1d7d7149d4bc2692322754e3c5d0
Fixes Issue 10325 - Constraints should be emitted for templated declarations.

https://github.com/D-Programming-Language/dmd/commit/4bbef4f21141c6b21f35d133f348a3b215ad6513


 Issue 10325 - Constraints should be emitted for templated declarations

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


Andrei Alexandrescu <andrei erdani.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |andrei erdani.com
         Resolution|                            |FIXED


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