Luke Palmer skribis 2006-08-31 15:48 (-0600):
> > I don't think using a method (even if called "s") is good huffman
> > coding. My expectation is that copying substitution will be used much -
> > perhaps even more than mutating substitution!
> And so a method called "s" is poor huffman coding... why? (I do agree
> with your frequency conjecture)

Because of the awkward syntax that goes with a method: two parens, four
delimiters, comma[s]?.

    .s(/bar/, "baz");  # 20 keypresses on a US keyboard

While a postfix operator, with the same ".s" feel, could allow
    .s/bar/baz/;       # 12 keypresses on a US keyboard

And since it's something used a lot in expressions, you wouldn't use the
parenless form of the method call much.

We need a quotelike construct for this form of s/// for exactly the same
reason we need it for m// and the other s///. Our language deviates too
much from being Perl if we had only method forms.

    $foo.subst(/foo/, "bar");
    $foo.=subst(/foo/, "bar");
That just isn't Perlish, at all.

My suggestion for a s/// postfix op mainly stems from this argument, but
I really also believe that ~~ and s/// is a farfetched combination. Perl
5's =~ was a binding operator, and s/// fit right in. But Perl 6's ~~ is
a matching operator, and in my opinion should remain pure, and so: not

I'm even a bit inclined to suggest that .m// should return matches,
while ~~m// should return a bool. But ignore that for now :)


Reply via email to