[GSOC] regular expressions beta is here

Jacob Carlborg doob at me.com
Wed Aug 10 09:46:25 PDT 2011


On 2011-08-10 17:55, Dmitry Olshansky wrote:
> On 10.08.2011 18:54, Jacob Carlborg wrote:
>>> Interesting idea, one problem with it is that I want this:
>>>
>>> auto m = match("bleh", "bleh");
>>> writeln(m);
>>>
>>> to actually print "bleh", not true
>>> Right now due to a carry over bug from std.regex (interface thing)
>>> writln(m) will just do a stackoverflow, m.hit however works.
>>
>> No, that won't be any problem:
>>
>> struct Foo
>> {
>> bool b;
>> alias b this;
>> }
>>
>> auto f = Foo();
>> static assert(is(typeof(f) == Foo));
>>
>> The above assert passes as expected.
> That may be all well, but try writeln on it, what will it print?

Hmm, it doesn't print anything, I think it looks like a bug in writeln.

> After some experience with alias this I had to conclude that it's rather
> blunt tool, and I'd rather stay away of it.
> Actually I like Steven's opCast suggestion, so that it works in
> conditionals.

Oh, I didn't know that it would work implicitly in conditionals. Then 
I'm happy with opCast :)

-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list