View mode: basic / threaded / horizontal-split · Log in · Help
January 25, 2013
[Issue 9391] New: Constant std.regex.regex
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@puremagic.com
       ReportedBy: bearophile_hugs@eml.cc


--- Comment #0 from bearophile_hugs@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: -------
January 25, 2013
[Issue 9391] Constant std.regex.regex
http://d.puremagic.com/issues/show_bug.cgi?id=9391


Dmitry Olshansky <dmitry.olsh@gmail.com> changed:

          What    |Removed                     |Added
----------------------------------------------------------------------------
                CC|                            |dmitry.olsh@gmail.com
          Severity|enhancement                 |normal


--- Comment #1 from Dmitry Olshansky <dmitry.olsh@gmail.com> 2013-01-25 12:50:39 PST ---
This is more like a minor bug. Got to fix it.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Top | Discussion index | About this forum | D home