Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

$/ in closure arg of subst #4783

Closed
p6rt opened this issue Nov 24, 2015 · 6 comments
Closed

$/ in closure arg of subst #4783

p6rt opened this issue Nov 24, 2015 · 6 comments

Comments

@p6rt
Copy link

p6rt commented Nov 24, 2015

Migrated from rt.perl.org#126721 (status was 'resolved')

Searchable as RT126721$

@p6rt
Copy link
Author

p6rt commented Nov 24, 2015

From @raiph

What I did

$/ := "Uhoh";
put "Foo".subst​: /Foo/, -> $/ {$/};
put "Foo".subst​: /Foo/, -> $/ {$/} for 1;
put "Foo".subst​: /Foo/, {$/};
put "Foo".subst​: /Foo/, {$/} for 1;

What I expected

FooFooFooFoo

What I got

FooFooUhohUhoh

Is it a bug?

The way it's working now might make sense from a purist pov but not a pragmatic or Perlish one imo. I'm hoping this will be obvious to whoever reads this so I'll defer giving a detailed rationale for calling this a bug in the anticipation that it won't be necessary. :)

Does it look like any other bug?

Yes, at least the previously resolved s/// bug #​118705.

See also http://www.perlmonks.org/?node_id=1148378

@p6rt
Copy link
Author

p6rt commented Nov 24, 2015

From @raiph

See also #RT122789

@p6rt
Copy link
Author

p6rt commented Oct 21, 2017

From @zoffixznet

On Mon, 23 Nov 2015 19​:40​:36 -0800, raiph wrote​:

What I did

$/ := "Uhoh";
put "Foo".subst​: /Foo/, -> $/ {$/};
put "Foo".subst​: /Foo/, -> $/ {$/} for 1;
put "Foo".subst​: /Foo/, {$/};
put "Foo".subst​: /Foo/, {$/} for 1;

What I expected

FooFooFooFoo

What I got

FooFooUhohUhoh

Is it a bug?

The way it's working now might make sense from a purist pov but not a
pragmatic or Perlish one imo. I'm hoping this will be obvious to
whoever reads this so I'll defer giving a detailed rationale for
calling this a bug in the anticipation that it won't be necessary. :)

Does it look like any other bug?

Yes, at least the previously resolved s/// bug #​118705.

See also http://www.perlmonks.org/?node_id=1148378

Thank you for the report. This is now fixed.

Fix​: rakudo/rakudo@738908be4d
Test​: Raku/roast@80a49c4324

@p6rt
Copy link
Author

p6rt commented Oct 21, 2017

The RT System itself - Status changed from 'new' to 'open'

@p6rt
Copy link
Author

p6rt commented Oct 21, 2017

@zoffixznet - Status changed from 'open' to 'resolved'

@p6rt p6rt closed this as completed Oct 21, 2017
@p6rt
Copy link
Author

p6rt commented Nov 5, 2017

From @zoffixznet

On Sat, 21 Oct 2017 08​:28​:19 -0700, cpan@​zoffix.com wrote​:

On Mon, 23 Nov 2015 19​:40​:36 -0800, raiph wrote​:

What I did

$/ := "Uhoh";
put "Foo".subst​: /Foo/, -> $/ {$/};
put "Foo".subst​: /Foo/, -> $/ {$/} for 1;
put "Foo".subst​: /Foo/, {$/};
put "Foo".subst​: /Foo/, {$/} for 1;

What I expected

FooFooFooFoo

What I got

FooFooUhohUhoh

Is it a bug?

The way it's working now might make sense from a purist pov but not a
pragmatic or Perlish one imo. I'm hoping this will be obvious to
whoever reads this so I'll defer giving a detailed rationale for
calling this a bug in the anticipation that it won't be necessary. :)

Does it look like any other bug?

Yes, at least the previously resolved s/// bug #​118705.

See also http://www.perlmonks.org/?node_id=1148378

Thank you for the report. This is now fixed.

Fix​: rakudo/rakudo@738908be4d
Test​: Raku/roast@80a49c4324

I ended up reverting the tests and the fix. There was fallout from ~20 modules due to this
and it feels to me having method forms mess with $/ is going against the grain for how the
users tend to use these routines.

I filed another Issue rakudo/rakudo#1235 for this problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant