Bug 12960 – Template constraint documentation should be verbatim (minus formatting issues)

Status
NEW
Severity
enhancement
Priority
P4
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2014-06-22T06:38:52Z
Last change time
2024-12-13T18:21:41Z
Assigned to
No Owner
Creator
Jonathan M Davis
Moved to GitHub: dmd#18840 →

Comments

Comment #0 by issues.dlang — 2014-06-22T06:38:52Z
The documentation for enforceEx shows this problem: http://dlang.org/phobos/std_exception.html#.enforceEx __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.
Comment #1 by robert.schadek — 2024-12-13T18:21:41Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/18840 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB