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

"use" after "module" executes out of order in compiled PIR #551

Closed
p6rt opened this issue Dec 29, 2008 · 6 comments
Closed

"use" after "module" executes out of order in compiled PIR #551

p6rt opened this issue Dec 29, 2008 · 6 comments
Labels

Comments

@p6rt
Copy link

p6rt commented Dec 29, 2008

Migrated from rt.perl.org#61826 (status was 'rejected')

Searchable as RT61826$

@p6rt
Copy link
Author

p6rt commented Dec 29, 2008

From @jeffhorwitz

assume the following three files​:

Bar.pm​:
  say "in Bar.pm";

foo1.p6​:
  module Foo;
  use Bar;
  say "in Foo";

foo2.p6​:
  use Bar;
  module Foo;
  say "in Foo";

the output of foo1.p6 and foo2.p6 is the same when run using the p6
source​:

[jeff@​groovy perl6]$ ../../parrot perl6.pbc foo1.p6
in Bar.pm
in Foo
[jeff@​groovy perl6]$ ../../parrot perl6.pbc foo2.p6
in Bar.pm
in Foo

however, compile the scripts to PIR and the following happens​:

[jeff@​groovy perl6]$ ../../parrot foo1.pir
in Foo
in Bar.pm
[jeff@​groovy perl6]$ ../../parrot foo2.pir
in Bar.pm
in Foo

foo1.pir behaves differently from its p6 source -- it processes the "use"
*after* executing the body of the script, which is incorrect. the
placement of the module declaration is the only difference.

-jeff

@p6rt
Copy link
Author

p6rt commented Dec 30, 2008

From @pmichaud

On Mon Dec 29 12​:49​:10 2008, jhorwitz wrote​:

assume the following three files​:

Bar.pm​:
say "in Bar.pm";

foo1.p6​:
module Foo;
use Bar;
say "in Foo";

foo2.p6​:
use Bar;
module Foo;
say "in Foo";

This second version (foo2.p6) isn't valid Perl 6. Rakudo doesn't
recognize it as an error yet, but it is one.

That still leaves the question of why foo1.p6 is changing for the
compiled versus non-compiled version -- I'll look into it.

Pm

@p6rt
Copy link
Author

p6rt commented Dec 30, 2008

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

@p6rt
Copy link
Author

p6rt commented Sep 19, 2010

From sohtil@gmail.com

With current rakudo, the compiled version behaves the same as the
uncompiled one. The code in foo2.p6 is still accepted, though​:

$ ./perl6 foo1.p6
in Bar.pm
in Foo
$ ./perl6 foo2.p6
in Bar.pm
in Foo

$ ./perl6 --target=pir -o foo1.pir foo1.p6
in Bar.pm
$ ./perl6 --target=pir -o foo2.pir foo2.p6
in Bar.pm

$ ~/local/parrot/bin/parrot foo1.pir
in Bar.pm
in Foo
$ ~/local/parrot/bin/parrot foo2.pir
in Bar.pm
in Foo

This is Rakudo Perl 6, version 2010.08-119-gccde8dc built on parrot
2.7.0 r49158

Lithos

@p6rt
Copy link
Author

p6rt commented Jun 25, 2012

From @pmichaud

Currently Rakudo isn't supporting execution of pir scripts directly; thus
rejecting this ticket. (We may support this option in the future; for
now it's unsupported.)

Pm

@p6rt
Copy link
Author

p6rt commented Jun 25, 2012

@pmichaud - Status changed from 'open' to 'rejected'

@p6rt p6rt closed this as completed Jun 25, 2012
@p6rt p6rt added the Bug label Jan 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant