On 22/09/05, Juerd <[EMAIL PROTECTED]> wrote:
> By the way, is it really this simple?
>     class HTTP::Header is Pair {
>         foo {
>             "{.key}: {.value ~~ s/\n/\n /g}"
>         }
>     }
> Where "foo" is whatever is needed to override stringification.

Something along the lines of `method prefix:<~>`, IIRC.

> I am assuming that s/// does not mutate, because mutation isn't
> something I think a smart *match* operator should do. (To be honest, I
> don't think s/// and ~~ should belong together.) How does this actually
> work?

This always bugged me as well. I think it currently still mutates (for
culture-backwards-compatibility reasons), but I do think the match
operator needs to be distinguished from the substitute/translate
operator. We also need to be able to choose between copying and
mutation. In my view, smart-match (~~) should be first and foremost
about returning a meaningful boolifiable value.

(If people want to discuss it further it's probably best to start a new thread.)

> Also, it'd be nice to be able to say s/^^/ /g, but have it skip the
> first. There's :2nd, but is there also something like :(2...)th?

S05 has:
# Lists and junctions are allowed: :nth(1|2|3|5|8|13|21|34|55|89).

So I assume :nth(2...) would work as expected.

Oh, and remember to start putting your `:g`s at the start of the
substitution/rule :-)


Reply via email to