develooper Front page | perl.perl6.language | Postings from April 2003

Re: Ruminating RFC 93- alphabet-blind pattern matching

Thread Previous | Thread Next
From:
Yary Hluchan
Date:
April 3, 2003 11:30
Subject:
Re: Ruminating RFC 93- alphabet-blind pattern matching
Message ID:
200304031930.h33JUIb06200@bell.apicom.com
a = arcadi shehter <fearcadi@figaro.weizmann.ac.il>
a>I think this was already discussed once and then it was proposed to
a>attach a property to characters of the string
a>
a> sub peek_at_sky {
a>
a>     my Color  @numbers = peek_with_some_hardware;
a>
a>     my $say_it =  join map { "1" but color($_) } @numbers ;
a>     return $say_it ;
a> }
a>
a>
a>   rule color { (.) { let $0 := $1.color } }
a>
a>   $daylight = &peek_at_sky =~ /<color>+/; # is something in sky

That works and isn't too bad, a quick fix with some interesting
possibilities. Should be an example in the documentation. Still,
the RFC that opened this discussion opens a different way-

http://dev.perl.org/rfc/93.html
http://www.perl.com/pub/a/2002/06/04/apo5.html?page=17#rfc%20093:%20regex:%20support%20for%20incremental%20pattern%20matching

Once a user-defined sub can hand characters to rexen- it could hand
anything over (floats, refs, etcetera).  It's an opportunity ripe
for exploitation.

-y

~~~~~

The Moon is Waxing Crescent (4% of Full)

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