www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 12960] New: Template constraint documentation should be

https://issues.dlang.org/show_bug.cgi?id=12960

          Issue ID: 12960
           Summary: Template constraint documentation should be verbatim
                    (minus formatting issues)
           Product: D
           Version: unspecified
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: DMD
          Assignee: nobody puremagic.com
          Reporter: jmdavisProg gmx.com

The documentation for enforceEx shows this problem:


__FILE__ and __LINE__ are used in the template constraint, but unfortunately,
they get replaced with the values that they have at that point in the file. So,
in the documentation, instead of

template enforceEx(E) if (is(typeof(new E("", __FILE__, __LINE__))))

we get

template enforceEx(E) if (is(typeof(new E("", "std/exception.d", 524))))

which is likely to be confusing to folks. The compiler is smart enough to put
__FILE__ and __LINE__ explicitly in the docs if they're default arguments, but
not when they're inside a constraint. It wouldn't surprise me if the compiler
substituted enums for their values if used in constraints as well (though I
haven't verified that). But regardless of what is in the template constraint, I
think that if they're going to be listed in the documentation, then they should
be listed as they are in the source file and that nothing in them should be
replaced with the values that they evaluate to when actually compiled.

--
Jun 21 2014