Perlists,
In Perl 5, lc, lcfirst, quotemeta, uc and ucfirst don't mutate.
chomp and chop do mutate.
I imagine these will all be methods in Perl 6:
$foo.lc
$foo.quotemeta
$foo.chomp
I'd like a mutating version of lc, and a non-mutating version of chomp.
With some nice syntax, if
Juerd writes:
Perlists,
In Perl 5, lc, lcfirst, quotemeta, uc and ucfirst don't mutate.
chomp and chop do mutate.
I imagine these will all be methods in Perl 6:
$foo.lc
$foo.quotemeta
$foo.chomp
I'd like a mutating version of lc, and a non-mutating version of chomp.
Luke Palmer wrote:
The reason we couldn't just decalre it with Cinfix:.= is because its
right hand side is not a usual expression.
Isn't that what macros are for?
macro infix:.= ($lhs, $rhs) is parsed(/method_name/) {
return Perl::assignment_expression.new(
lhs = $lhs,
On Wed, Mar 10, 2004 at 05:39:33PM +0100, Juerd wrote:
: Perlists,
:
: In Perl 5, lc, lcfirst, quotemeta, uc and ucfirst don't mutate.
: chomp and chop do mutate.
:
: I imagine these will all be methods in Perl 6:
:
: $foo.lc
: $foo.quotemeta
: $foo.chomp
:
: I'd like a mutating
On Wed, Mar 10, 2004 at 11:19:52AM -0800, Brent Dax Royal-Gordon wrote:
: Luke Palmer wrote:
: The reason we couldn't just decalre it with Cinfix:.= is because its
: right hand side is not a usual expression.
:
: Isn't that what macros are for?
:
: macro infix:.= ($lhs, $rhs) is
Larry Wall writes:
On Wed, Mar 10, 2004 at 11:19:52AM -0800, Brent Dax Royal-Gordon wrote:
: Luke Palmer wrote:
: The reason we couldn't just decalre it with Cinfix:.= is because its
: right hand side is not a usual expression.
:
: Isn't that what macros are for?
:
: macro infix:.=
On Wed, Mar 10, 2004 at 12:42:00PM -0700, Luke Palmer wrote:
: (Also, these days you have to say ?foo to collect the results into $0.)
:
: Hooray! That was something I had been worried about.
:
: But C? doesn't seem to fit visually. What's questionable about
: that?
It's questionable insofar
Larry Wall writes:
On Wed, Mar 10, 2004 at 12:42:00PM -0700, Luke Palmer wrote:
: I can think of a couple that I like better:
:
: ^foo
: *foo
:
: ^foo is my favorite at the moment (even though *foo is more
: visually pleasing), because it looks like it's transferring the
:
Luke Palmer wrote:
I understand the association with C$?foo. But most of the time, when
I'm writing a grammar, I'm catching these rules in order to stick them
in the parse tree, not to do tests on them later on in the rule. The
very essence of rules is hypotheticality, where nothing is
Damian Conway wrote:
/ $foo:=(abc) $bar:=(def) /
Am I misreading, or are you suggesting that $foo may contain 'abc' after
running this example, even if the match wasn't successful?
--
Brent Dax Royal-Gordon [EMAIL PROTECTED]
Perl and Parrot hacker
Oceania has always been at war with
Brent Dax Royal-Gordon wrote:
/ $foo:=(abc) $bar:=(def) /
Am I misreading, or are you suggesting that $foo may contain 'abc' after
running this example, even if the match wasn't successful?
No. I re-checked with Larry this morning and he confirmed that all bindings in
rules only stick if
I was thinking along the lines of...
String $foo = hello;
$foo.scramble!
print $foo\n;
$foo = hello
print $foo.scramble ~ \n;
print $foo;
OUTPUT (or close):
elhlo
hloel
hello
Also, along these same things.. is there a way to apply a method to all
variables/objects of a certain type (e.g.
On Wed, Mar 10, 2004 at 10:46:05PM -0500, matt wrote:
: I was thinking along the lines of...
:
: String $foo = hello;
: $foo.scramble!
That would be $foo.=scramble in the current scheme of things.
: print $foo\n;
: $foo = hello
: print $foo.scramble ~ \n;
: print $foo;
:
: OUTPUT (or close):
:
-Original Message-
From: Damian Conway [mailto:[EMAIL PROTECTED]
Sent: Wednesday, 10 March, 2004 09:48 PM
To: [EMAIL PROTECTED]
Subject: Re: Mutating methods
Brent Dax Royal-Gordon wrote:
/ $foo:=(abc) $bar:=(def) /
Am I misreading, or are you suggesting that $foo may
On Thu, Mar 11, 2004 at 01:09:59AM -0500, Austin Hastings wrote:
:
:
: -Original Message-
: From: Damian Conway [mailto:[EMAIL PROTECTED]
: Sent: Wednesday, 10 March, 2004 09:48 PM
: To: [EMAIL PROTECTED]
: Subject: Re: Mutating methods
:
:
: Brent Dax Royal-Gordon wrote:
:
:
15 matches
Mail list logo