Thread overview
[Issue 10325] New: ddoc: template constraints inconsistently shown in generated html
Jun 10, 2013
Jonathan M Davis
Jun 11, 2013
Andrej Mitrovic
Jun 11, 2013
Andrej Mitrovic
June 10, 2013
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


--- Comment #0 from thelastmammoth@gmail.com 2013-06-10 14:32:13 PDT ---
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: -------
June 10, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10325


bearophile_hugs@eml.cc changed:

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


--- Comment #1 from bearophile_hugs@eml.cc 2013-06-10 14:54:24 PDT ---
(In reply to comment #0)

> 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: -------
June 10, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10325


Jonathan M Davis <jmdavisProg@gmx.com> changed:

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


--- Comment #2 from Jonathan M Davis <jmdavisProg@gmx.com> 2013-06-10 15:00:38 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: -------
June 11, 2013
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


--- Comment #3 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2013-06-11 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: -------
June 11, 2013
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


--- Comment #4 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2013-06-11 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: -------
June 11, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10325



--- Comment #5 from github-bugzilla@puremagic.com 2013-06-11 09:27:45 PDT ---
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 Merge pull request #2161 from AndrejMitrovic/Fix10325

 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: -------
June 11, 2013
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: -------