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

Weird interaction between constants, Xops and pre-comp. #4898

Open
p6rt opened this issue Dec 20, 2015 · 4 comments
Open

Weird interaction between constants, Xops and pre-comp. #4898

p6rt opened this issue Dec 20, 2015 · 4 comments
Labels

Comments

@p6rt
Copy link

p6rt commented Dec 20, 2015

Migrated from rt.perl.org#126974 (status was 'new')

Searchable as RT126974$

@p6rt
Copy link
Author

p6rt commented Dec 20, 2015

From @thundergnat

If I build constant arrays, use those arrays to built _other_ constant
arrays
with meta operators and then try to access those arrays from a pre compiled
module, I get an error​: "Cannot invoke this object"

It doesn't seem to happen if the arrays are declared "my" array,
It doesn't seem to happen if I don't use Meta operators to build the arrays.
It doesn't seem to happen when run in the same file, only when pre-compiled
and loaded as a module.

May be an example of DIHWIDT, but I spent several hours tracking
down errors that only occurred when code got packaged as a module
and pre-compiled.

See​: https://github.com/thundergnat/Lingua-EN-Numbers-Cardinal
for larger example.

Demo files attached​: Bogus.pm6 and bogus.p6

@p6rt
Copy link
Author

p6rt commented Dec 20, 2015

From @thundergnat

use lib '.';
use Bogus;
say broken(2);

@p6rt
Copy link
Author

p6rt commented Dec 20, 2015

From @thundergnat

use v6;

unit module Bogus;

constant @​d = < a b c d e >;
constant @​e = @​d X~ ' test';
constant @​f = @​d »~» ' test';

sub broken ($a) is export {
  say @​f[$a];
  say @​e[$a];
}

#broken(2);

@p6rt p6rt added the Bug label Jan 5, 2020
@usev6
Copy link

usev6 commented Oct 9, 2023

The error has changed, but there's still something wrong:

$ mkdir -p 4898
$ cat >gh4898/Bogus.rakumod 
unit module Bogus;

constant @d = < a b c d e >;
constant @e = @d X~ ' test';
constant @f = @d »~» ' test';

sub broken ($a) is export {
    say @f[$a];
    say @e[$a];
}
^D
$ ./rakudo-m -Igh4898 -e 'use Bogus; broken(2)'
c test
lang-call cannot invoke object of type 'VMNull' belonging to no language
  in sub broken at /usr/home/christian/perl6/perl6-roast-data/rakudo.moar/gh4898/Bogus.rakumod (Bogus) line 9
  in block <unit> at -e line 1

As reported, the error does only happen with precompilation. It goes away with no precompilation; added at the top of gh4898/Bogus.rakumod.

$ cat gh4898/Bogus.rakumod 
no precompilation;
unit module Bogus;

constant @d = < a b c d e >;
constant @e = @d X~ ' test';
constant @f = @d »~» ' test';

sub broken ($a) is export {
    say @f[$a];
    say @e[$a];
}
^D
$ ./rakudo-m -Igh4898 -e 'use Bogus; broken(2)'
c test
c test

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

2 participants