develooper Front page | perl.perl6.language | Postings from May 2005

Re: C<::> in rules

Thread Previous | Thread Next
Larry Wall
May 12, 2005 21:16
Re: C<::> in rules
Message ID:
On Thu, May 12, 2005 at 09:33:37AM -0500, Patrick R. Michaud wrote:
: Also, A05 proposes incorrect alternatives to the above 
:     /[:w[]foo bar]/    # null pattern illegal, use <null>
:     /[:w()foo bar]/    # null capture illegal, and probably undesirable
:     /[:w\bfoo bar]/    # not exactly the same as above
: I'd like to remove those from A05, or at least put an "Update:"
: note there that doesn't lead people astray.  One option not
: mentioned in A05 that we can add there is
:     /[:w<?null>foo bar]/  
: which is admittedly ugly.

I would just like to point out that you are misreading those.
The [] and () above are part of pair syntax, not rule syntax.
Likewise your :w<?null> should be taken to :w('?null').  We used to
try to distinguish modifiers like :w that don't take an argument,
but that's a bad plan.  All colon pairs parse alike wherever they
occur.  That's why we've required space before bracket delimiters
outside, but the same constraint holds inside rules.

Which means, of course, that we should probably try to figure
what :w($x) actually means...  :-)

Speaking of which, it seems to me that :p and :c should allow an
argument that says where to start relative to the current position.
In other words, :p means :p(0) and :c means :c(0).  I could also see
uses for :p(-1) and :p(+1).

We could also pass positions as opaque objects, which is another
reason not to consider positions as mere numbers.


Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About