[Issue 18812] New: template enforce should accept same parameter combos as exception
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sun Apr 29 23:13:00 UTC 2018
https://issues.dlang.org/show_bug.cgi?id=18812
Issue ID: 18812
Summary: template enforce should accept same parameter combos
as exception
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: enhancement
Priority: P1
Component: phobos
Assignee: nobody at puremagic.com
Reporter: elpenguino+D at gmail.com
Currently, the enforce!SomeException form of enforce can use only msg/file/line
combinations. I believe this is an unnecessary restriction and this form of
enforce should be able to use any constructor for SomeException as long as
enforce's parameters match up - for example:
`
class SomeException : Exception {
uint somethingMeaningful;
this(uint a) {
somethingMeaningful = a;
super("Something went wrong!");
}
}
enforce!SomeException(false, 4);
`
Removing this restriction would be a HUGE usability improvement and would make
this much more viable in @nogc code.
--
More information about the Digitalmars-d-bugs
mailing list