[GSOC] regular expressions beta is here

Dmitry Olshansky dmitry.olsh at gmail.com
Wed Aug 10 08:08:58 PDT 2011


On 10.08.2011 16:54, Steven Schveighoffer wrote:
> On Wed, 10 Aug 2011 07:51:32 -0400, Dmitry Olshansky 
> <dmitry.olsh at gmail.com> wrote:
>
>> On 10.08.2011 15:34, Jacob Carlborg wrote:
>>> On 2011-08-10 12:42, Dmitry Olshansky wrote:
>>>> In case I failed to mention it before, I m working on the project
>>>> codenamed FReD that is aimed at ~100%* source level compatible 
>>>> overhaul
>>>> of std.regex, that uses better implementation techniques, provides
>>>> modern Unicode support and common syntax riches.
>>>>
>>>> I think it's time for a public beta release, since it _should_ be 
>>>> ready
>>>> for mainstream usage. There are some rough edges, and a couple issues
>>>> that I'm aware of but they are nowhere in realistic use cases.
>>>>
>>>> In order to avoid unexpected regressions I'd be glad if current
>>>> std.regex users do try it for their projects/tests.
>>>> To get a small no-crap-included beta package see download section of
>>>> https://github.com/blackwhale/FReD for .7zs.
>>>> I'll upload newer packages as bugs get exposed and fixed. 
>>>> Alternatively,
>>>> if you a comfortable with git you may just git clone entire repo. Some
>>>> helpful notes (same as README) can be found here :
>>>> https://github.com/blackwhale/FReD/wiki/Beta-release
>>>>
>>>> Caveats:
>>>> In order for it compile a tiny change to 2.054 source is needed (no 
>>>> need
>>>> to recompile Phobos! it's only in templates):
>>>> patch std.algorithm.cmp according to this diff
>>>> https://github.com/D-Programming-Language/phobos/pull/176/files#L0L4631 
>>>>
>>>> <https://github.com/D-Programming-Language/phobos/pull/176/files#L0L4633> 
>>>> and to get CTFE features working add if(!__ctfe) listed in the next 
>>>> diff
>>>> on the same webpage.
>>>> (this is already upstream, so if you're using a fork of phobos just 
>>>> pull
>>>> this in)
>>>>
>>>> * some API problems might lead to a breaking change, though it didn't
>>>> happen in this release
>>>
>>> I have a suggestion, make RegexMatch implicitly convertible to bool, 
>>> indicating if there was a match or not.
>>>
>> Interesting idea, one problem with it is that I want this:
>>
>> auto m = match("bleh", "bleh");
>> writeln(m);
>>
>> to actually print "bleh", not true
>
> Without actually looking at the code, why wouldn't something like this 
> work?
>
> struct RegexMatch
> {
>    ...
>    string toString() {...}
>    opCast(T : bool)() {...}
> }
>
> This isn't an implicit cast, but it will work for conditional statements.
>
Thanks, I'll give it a try.


-- 
Dmitry Olshansky



More information about the Digitalmars-d mailing list