develooper Front page | perl.perl6.internals | Postings from January 2002

Re: Question about "match" vtable method and regexes

Thread Previous | Thread Next
From:
Dan Sugalski
Date:
January 12, 2002 08:33
Subject:
Re: Question about "match" vtable method and regexes
Message ID:
5.1.0.14.2.20020112113326.0201fd90@pop.sidhe.org
At 10:23 AM 1/12/2002 -0600, David M. Lloyd wrote:
>On Sat, 12 Jan 2002, Dan Sugalski wrote:
>
> > At 09:05 PM 1/11/2002 -0600, David M. Lloyd wrote:
> > >I have a design question here.  Why did we take the approach of having a
> > >match method on every single vtable, instead of having a vtable for
> > >regular expressions, and have regex be an object (like Perl 5)?
> >
> > So we could do:
> >
> >    @results = @foo ^=~ /bar/;
> >
> > Basically to allow hypermatches.
>
>Would that become something like this:
>
>@results = @foo.match(qr/bar/);
>
>where the 'match' method is called on the PerlArray object, or would it
>be more like:
>
>@results = map { $_.match(qr/bar/); } @foo;  # Forgive the mixed p5/p6
>
>where the match method is called on each element of @foo?

The former. The PerlArray object's perfectly justified in then calling 
match on each element inside itself.

					Dan

--------------------------------------"it's like this"-------------------
Dan Sugalski                          even samurai
dan@sidhe.org                         have teddy bears and even
                                      teddy bears get drunk


Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About