Bug 16299 – Documentation for Phobos needs to warn about autodecoding

Status
NEW
Severity
enhancement
Priority
P4
Component
dlang.org
Product
D
Version
D2
Platform
All
OS
All
Creation time
2016-07-19T20:37:43Z
Last change time
2024-12-15T15:23:53Z
Assigned to
No Owner
Creator
Wyatt
Moved to GitHub: dlang.org#3959 →

Comments

Comment #0 by wyatt.epp — 2016-07-19T20:37:43Z
Problem: The anomalous effects of autodecoding for Phobos functions are _effectively_ undocumented. This means an innocent user has no warning that something like std.algorithm.iteration.permutations will fail on an array of char[] (a very common built-in type). This is bad. Possible fixes: - Add warnings (with text _and_ links) that using char[] is going to screw users: If using a char[] is going to break something, that should be mentioned in the documentation for it. There at least needs to be a generic warning that stands out visually and links to further information on the autodecoding problem and how to work around it. - Add examples that show affected templates used on char[] and dchar[]: Most of the examples are conscripted unit tests using integers. - Have the compiler explain the actual problem: Ugly? Maybe. Special casing is bad? Sure. But the current error is really obtuse when you can do exactly what the example does only with a different type and get "cannot deduce function from argument types". That's way out of left field. - Make it actually work like it should: Especially if the input is known at compile time, autodecoding shouldn't even be a problem. But even at runtime, this should just work without fuss. Users shouldn't have to hunt down the documentation for template constraints if they're not writing range types of their own; we made them grey because most people _can_ ignore them. See Also: Comments on issue #16263
Comment #1 by robert.schadek — 2024-12-15T15:23:53Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dlang.org/issues/3959 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB