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

Make require use CompUnit interface for importing #694

Merged
merged 1 commit into from Feb 14, 2016

Conversation

LLFourn
Copy link
Contributor

@LLFourn LLFourn commented Jan 27, 2016

Uses the CompUnit object to do the importing of symbols and merging of globalish in &REQUIRE_IMPORT instead of some haphazard CALLER::OUR:: thing. This makes things a bit less brittle and fixes a few bugs.

The following now works:
my $name = "/lib/Module.pm"; require $name <sym>;
require Module <sym>; # where <sym> isn't inside a module/package

bonus: no more "useless use of blah in sink context"
Fixes:

note the first chunk removed in actions is just because it's dead code that can't be reached.

@LLFourn
Copy link
Contributor Author

LLFourn commented Jan 27, 2016

tests: Raku/roast#100

@jonathanstowe
Copy link
Contributor

👍

@LLFourn LLFourn force-pushed the fix-require branch 2 times, most recently from b87cec3 to d924ae2 Compare January 30, 2016 07:15
@@ -1821,32 +1807,20 @@ class Perl6::Actions is HLL::Actions does STDActions {
),
);
}
$past.push(QAST::Op.new(
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Merging of GLOBALish moved to REQUIRE_IMPORT

@LLFourn
Copy link
Contributor Author

LLFourn commented Jan 30, 2016

I've cleared up this commit a bit and added a bunch of github comments to make things a bit clearer.

@salortiz
Copy link
Contributor

👍

@lizmat
Copy link
Contributor

lizmat commented Feb 13, 2016

Seems this patch causes some breakage for me, e.g.:

$ perl6 t/spec/S01-perl-5-integration/exception_handling.t
1..3
===SORRY!===
ctxlexpad needs an MVMContext

Looks like you planned 3 tests, but ran 0

Complete list:
t/spec/S01-perl-5-integration/return.rakudo.moar (Wstat: 65280 Tests: 0 Failed: 0)
Non-zero exit status: 255
Parse errors: Bad plan. You planned 2 tests but ran 0.
t/spec/S01-perl-5-integration/class.rakudo.moar (Wstat: 256 Tests: 1 Failed: 1)
Failed test: 1
Non-zero exit status: 1
Parse errors: Bad plan. You planned 3 tests but ran 1.
t/spec/S01-perl-5-integration/exception_handling.t (Wstat: 65280 Tests: 0 Failed: 0)
Non-zero exit status: 255
Parse errors: Bad plan. You planned 3 tests but ran 0.
t/spec/S01-perl-5-integration/import.rakudo.moar (Wstat: 256 Tests: 1 Failed: 1)
Failed test: 1
Non-zero exit status: 1
Parse errors: Bad plan. You planned 3 tests but ran 1.

Is this a known issue with this patch?

@LLFourn
Copy link
Contributor Author

LLFourn commented Feb 13, 2016

Oh I never tested p5 integration. I'll take a look thanks.
On Sun, 14 Feb 2016 at 12:28 AM, lizmat notifications@github.com wrote:

Seems this patch causes some breakage for me, e.g.:

$ perl6 t/spec/S01-perl-5-integration/exception_handling.t
1..3
===SORRY!===
ctxlexpad needs an MVMContext
Looks like you planned 3 tests, but ran 0

Complete list:
t/spec/S01-perl-5-integration/return.rakudo.moar (Wstat: 65280 Tests: 0
Failed: 0)
Non-zero exit status: 255
Parse errors: Bad plan. You planned 2 tests but ran 0.
t/spec/S01-perl-5-integration/class.rakudo.moar (Wstat: 256 Tests: 1
Failed: 1)
Failed test: 1
Non-zero exit status: 1
Parse errors: Bad plan. You planned 3 tests but ran 1.
t/spec/S01-perl-5-integration/exception_handling.t (Wstat: 65280 Tests: 0
Failed: 0)
Non-zero exit status: 255
Parse errors: Bad plan. You planned 3 tests but ran 0.
t/spec/S01-perl-5-integration/import.rakudo.moar (Wstat: 256 Tests: 1
Failed: 1)
Failed test: 1
Non-zero exit status: 1
Parse errors: Bad plan. You planned 3 tests but ran 1.

Is this a known issue with this patch?


Reply to this email directly or view it on GitHub
#694 (comment).

@LLFourn
Copy link
Contributor Author

LLFourn commented Feb 13, 2016

So the problem with this patch is that it uses UNIT:: and there is a bug in rakudo:

BEGIN { UNIT; Nil }
An exception occurred while evaluating a BEGIN
at -e:1
Exception details:
  ===SORRY!=== Error while compiling 
  ctxlexpad needs an MVMContext

And CU::R::Perl5 uses require which is naturally run at BEGIN time. I'll see what I can do.

The following now works:
1. require 'lib/Module.pm' <sym>;
2. require Module <sym>; # where <sym> isn't inside a module

Also, no more erroneous "useless use of.." sink context when doing
`require ::('Test') <&ok>`.
@LLFourn
Copy link
Contributor Author

LLFourn commented Feb 14, 2016

changed CALLER::UNIT::GLOBALish to CALLER::LEXICAL::GLOBALish:: to find the globalish to merge into. It seems to work at compile time and runtime (IP5 tests pass now).

Tests for require at compile time added in:
LLFourn/roast@2246a97

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

Successfully merging this pull request may close these issues.

None yet

4 participants