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

wrong namespace in eval #692

Closed
p6rt opened this issue Feb 11, 2009 · 4 comments
Closed

wrong namespace in eval #692

p6rt opened this issue Feb 11, 2009 · 4 comments

Comments

@p6rt
Copy link

p6rt commented Feb 11, 2009

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

Searchable as RT63158$

@p6rt
Copy link
Author

p6rt commented Feb 11, 2009

From @ilyabelikin

Hi there!

This is works​:

our $x = 42; eval('our $x; say $x;')

but this is not​:

lass TP {
  has $.out is rw = '';
}

class M {
  method work {
  our $T = TP.new;
  eval('our $T; $T.out ~= "Yay";');
  say $T.out;
  }
}

my $t = M.new;
$t.work;

jabber logs​:

Jonathan​: Oh!
I bet that the $T is being actually $M​::T
And inside the eval we don't have the namespace correctly.
yes
module Foo { our $x = 42; eval('our $x; say $x;') }
}
oops
anyway, that explodes
Ticket welcome. :-)

Thank you!

Ilya Belikin aka Ihrd

@p6rt
Copy link
Author

p6rt commented May 1, 2009

From @jnthn

On Wed Feb 11 08​:09​:56 2009, ihrd wrote​:

Hi there!

This is works​:

our $x = 42; eval('our $x; say $x;')

but this is not​:

lass TP {
has $.out is rw = '';
}

class M {
method work {
our $T = TP.new;
eval('our $T; $T.out ~= "Yay";');
say $T.out;
}
}

my $t = M.new;
$t.work;

jabber logs​:

Jonathan​: Oh!
I bet that the $T is being actually $M​::T
And inside the eval we don't have the namespace correctly.
yes
module Foo { our $x = 42; eval('our $x; say $x;') }
}
oops
anyway, that explodes
Ticket welcome. :-)

I've fixed this now in git 3262dd7, and there is also a test enabled as
a result of the fix (came from another ticket).

Thanks,

Jonathan

@p6rt
Copy link
Author

p6rt commented May 1, 2009

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

@p6rt
Copy link
Author

p6rt commented May 1, 2009

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

@p6rt p6rt closed this as completed May 1, 2009
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