On Wed, Nov 19, 2003 at 09:03:38AM -0500, Austin Hastings wrote:
:
:
: > -----Original Message-----
: > From: Joe Gottman [mailto:[EMAIL PROTECTED]
: > Sent: Tuesday, November 18, 2003 9:58 PM
: > To: Perl6
: > Subject: Re: [perl] RE: s/// in string context should return the string
: >
: >
: > ----- Original Message -----
: > From: "Austin Hastings" <[EMAIL PROTECTED]>
: > To: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
: > Sent: Tuesday, November 18, 2003 3:04 PM
: > Subject: [perl] RE: s/// in string context should return the string
: >
: >
: > > As a "Bvalue" where possible, so they can cascade and nest.
: >
: > Excuse me. I know enough C++ to know the difference between an lvalue
: > and an rvalue, but what the heck is a BValue?
:
: Something which could be Bound to another rex. Vis (p5):
:
: $x =~ s/foo/bar/ =~ s/moo/goo/;
:
: Might as well make them chainable.
Sigh. There's no =~ operator in Perl 6.
And it's not at all clear that ~~ should be associative. In fact,
it's not at all clear that ~~, a symmetrical operator, should bind
to any kind of mutator (using the term loosely). Operations that
have side effects are inherently asymmetrical and should probably be
bound with . in any event. And that does associate left to right,
though there are no guarantees that the returned value of a method is
the left one. The only mutator operator that currently does that is
"but". So maybe it could be something like:
$x but s/foo/bar/ but s/moo/goo/;
We'd have to make "property" context recognize mutators for that to
work, though. I'm more inclined to make
$x.s/foo/bar/.s/moo/goo/;
work somehow. Basically .s would be a postfix quote macro, or some such.
I'm not sure I want to propose macromethods just yet. The compile-time
vs run-time typing and scoping issues would be hairy.
Having said all that about ~~ vs mutators, I note two interesting
facts-in-waiting:
1) The ~~ operator likes to match using regexes.
2) We've defined any regex to be a potential mutator if it uses <cut>.
Ah, consistency...
Larry