[Issue 9391] New: Constant std.regex.regex
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Thu Jan 24 18:52:06 PST 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9391
Summary: Constant std.regex.regex
Product: D
Version: D2
Platform: All
OS/Version: All
Status: NEW
Severity: enhancement
Priority: P2
Component: Phobos
AssignedTo: nobody at puremagic.com
ReportedBy: bearophile_hugs at eml.cc
--- Comment #0 from bearophile_hugs at eml.cc 2013-01-24 18:52:04 PST ---
This is a low-priority enhancement request (meta-enhancement request: in
Bugzilla I'd like different tags for different enhancement request priorities).
This code works:
import std.stdio, std.regex;
void main() {
auto r = regex(r"\d+", "g");
"10 20 30".match(r).writeln();
}
And prints:
[["10"], ["20"], ["30"]]
While this code:
import std.stdio, std.regex;
void main() {
const r = regex(r"\d+", "g");
"10 20 30".match(r).writeln();
}
Shows (dmd 2.062alpha):
test.d(4): Error: template std.regex.match does not match any function template
declaration. Candidates are:
...\dmd2\src\phobos\std\regex.d(6532): std.regex.match(R, RegEx)(R
input, RegEx re) if (isSomeString!(R) && is(RegEx ==
Regex!(BasicElementOf!(R))))
...\dmd2\src\phobos\std\regex.d(6539): std.regex.match(R, String)(R
input, String re) if (isSomeString!(R) && isSomeString!(String))
...\dmd2\src\phobos\std\regex.d(6545): std.regex.match(R, RegEx)(R
input, RegEx re) if (isSomeString!(R) && is(RegEx ==
StaticRegex!(BasicElementOf!(R))))
...\dmd2\src\phobos\std\regex.d(6532): Error: template std.regex.match cannot
deduce template function from argument types !()(string,const(Regex!(char)))
I suggest to support constant regex, if possible. (In D code I like to mark
everything as not mutable unless it has to mutate).
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list