FAQ
payload++ brought this up on #perl6:

in current Rakudo, $string ~~ /re/ sets $/ in the scope in which the
expression appears, ie

'a' ~~ /./;
say $/; # ouput: a

But $str.match(..) and $str.subst don't. The spec is rather silent, it
says "There are also method forms of m// and s///: [...] There is no
syntactic sugar here".

I setting of OUTER::$/ considered syntactic sugar?

I don't care either way, I'd just like some clarification so that I can
write tests and submit tickets (if appropriate).

Cheers,
Moritz

Search Discussions

  • Daniel Ruoso at Jul 12, 2009 at 9:27 pm

    Em Dom, 2009-07-12 às 22:51 +0200, Moritz Lenz escreveu:
    I setting of OUTER::$/ considered syntactic sugar?
    I don't care either way, I'd just like some clarification so that I can
    write tests and submit tickets (if appropriate).
    As far as I remember, it's not really OUTER::$/, but each routine
    implicitly declare

    my $/ is context<rw>;
    my $! is context<rw>;

    so what happens inside m// or s/// is that inside that it should look
    for $*/, as well as the process of failing should look for $*!. This
    also has the advantage of:

    {
    'abc' ~~ /abc/;
    say $/; # prints abc
    {
    my $/ is context<rw>;
    'bcd' ~~ /bcd';
    say $/; # prints bcd;
    }
    say $/; # still prints abc;
    }

    I'm pretty sure that was just said by TimToady on IRC a lot of time ago
    and no spec actually defines it.

    That being said, I don't think there's a reason for .match and .subst
    not to look and set $*/.

    daniel

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupperl6-language @
categoriesperl
postedJul 12, '09 at 8:51p
activeJul 12, '09 at 9:27p
posts2
users2
websiteperl6.org

2 users in discussion

Daniel Ruoso: 1 post Moritz Lenz: 1 post

People

Translate

site design / logo © 2021 Grokbase