[GSOC] regular expressions beta is here
Andrei Alexandrescu
SeeWebsiteForEmail at erdani.org
Wed Aug 10 10:42:54 PDT 2011
On 8/10/11 9:55 AM, 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?
> After some experience with alias this I had to conclude that it's rather
> blunt tool, and I'd rather stay away of it.
If alias this is any more blunt than regular subtyping (inheritance),
that would be a bug. Feel free to submit if you find such issues.
Andrei
More information about the Digitalmars-d
mailing list