Skip Menu |
Report information
Id: 131168
Status: open
Priority: 0/
Queue: perl6

Owner: Nobody
Requestors: mt1957 [at] gmail.com
Cc:
AdminCc:

Severity: (no value)
Tag: (no value)
Platform: (no value)
Patch Status: (no value)
VM: (no value)



Date: Mon, 17 Apr 2017 18:52:54 +0200
To: rakudobug [...] perl.org
From: mt1957 <mt1957 [...] gmail.com>
Subject: problems when using require ::($m)
Download (untitled) / with headers
text/plain 1.1k
Since I've installed perl6 version 2017.03-234-g0ebdaa4 built on MoarVM version 2017.03-128-gc9ab59c, several modules are experiencing failures when using the following construct (golfed down)(I am sure that the module loads)


my $m = 'somemodule';
require ::($m);
my $o = ::($m).new;


However, in a simple setup it works fine. I could manage to rewrite things in such a way that errors disappear, but I do not understand it. A question is 'Are the symbols loaded lexically in such a way that it is not possible to instantiate the class in another method?'

A remaining bug on windows(with latest rakudostar) shows the error;

Failed to load Config::TOML;
Lexical with name '&from-toml' does not exist in this frame

when using something like the following

my $m = 'Config::TOML';
require ::($m) <&from-toml>;

see also https://ci.appveyor.com/project/MARTIMM/config-datalang-refine/branch/master


Other things I've seen before are; not able to find the class name symbol when I want to instatiate the class, or the .^name is shorter than the real class name should be, which accounts for the first error.


Regards,
Marcel


RT-Send-CC: perl6-compiler [...] perl.org
Download (untitled) / with headers
text/plain 1.6k
On Mon, 17 Apr 2017 09:53:28 -0700, mt1957@gmail.com wrote: Show quoted text
> Since I've installed perl6 version 2017.03-234-g0ebdaa4 built on MoarVM > version 2017.03-128-gc9ab59c, several modules are experiencing failures > when using the following construct (golfed down)(I am sure that the > module loads) > > > my $m = 'somemodule'; > require ::($m); > my $o = ::($m).new; > > > However, in a simple setup it works fine. I could manage to rewrite > things in such a way that errors disappear, but I do not understand it. > A question is 'Are the symbols loaded lexically in such a way that it is > not possible to instantiate the class in another method?' > > A remaining bug on windows(with latest rakudostar) shows the error; > > Failed to load Config::TOML; > Lexical with name '&from-toml' does not exist in this frame > > when using something like the following > > my $m = 'Config::TOML'; > require ::($m) <&from-toml>; > > see also > https://ci.appveyor.com/project/MARTIMM/config-datalang-refine/branch/master > > > Other things I've seen before are; not able to find the class name > symbol when I want to instatiate the class, or the .^name is shorter > than the real class name should be, which accounts for the first error. > > > Regards, > Marcel > >
Can't reproduce either of the issues you describe. Do you have a piece of code we can run that repos the problem? Also, have you seen the lexical require Upgrade Notification? http://rakudo.org/2017/03/18/lexical-require-upgrade-info/ my $m = 'Test'; require ::($m) <&ok>; ok 1, 1; # OUTPUT: ok 1 - 1 my $m = 'DBIish'; require ::($m); my $o = ::($m).new; dd $o; # OUTPUT: DBIish $o = DBIish.new
Download (untitled) / with headers
text/plain 109b
For record, I ran my test on Rakudo version 2017.03-292-g0b5a41b built on MoarVM version 2017.03-138-g40881cd
From: mt1957 <mt1957 [...] gmail.com>
Subject: Re: [perl #131168] problems when using require ::($m)
To: perl6-compiler [...] perl.org
Date: Mon, 17 Apr 2017 19:29:22 +0200
Download (untitled) / with headers
text/plain 2.1k
On 17-04-17 19:12, Zoffix Znet via RT wrote: thanks for the link, I will look into it. The code for which the windows implementation fails but not on linux, can be found here; https://github.com/MARTIMM/config-datalang-refine/blob/master/lib/Config/DataLang/Refine.pm6 the requires are at line 57 and 64 and the error is thrown at line 193 where the function is used. thanks again, Marcel Show quoted text
> On Mon, 17 Apr 2017 09:53:28 -0700, mt1957@gmail.com wrote:
>> Since I've installed perl6 version 2017.03-234-g0ebdaa4 built on MoarVM >> version 2017.03-128-gc9ab59c, several modules are experiencing failures >> when using the following construct (golfed down)(I am sure that the >> module loads) >> >> >> my $m = 'somemodule'; >> require ::($m); >> my $o = ::($m).new; >> >> >> However, in a simple setup it works fine. I could manage to rewrite >> things in such a way that errors disappear, but I do not understand it. >> A question is 'Are the symbols loaded lexically in such a way that it is >> not possible to instantiate the class in another method?' >> >> A remaining bug on windows(with latest rakudostar) shows the error; >> >> Failed to load Config::TOML; >> Lexical with name '&from-toml' does not exist in this frame >> >> when using something like the following >> >> my $m = 'Config::TOML'; >> require ::($m) <&from-toml>; >> >> see also >> https://ci.appveyor.com/project/MARTIMM/config-datalang-refine/branch/master >> >> >> Other things I've seen before are; not able to find the class name >> symbol when I want to instatiate the class, or the .^name is shorter >> than the real class name should be, which accounts for the first error. >> >> >> Regards, >> Marcel >> >>
> Can't reproduce either of the issues you describe. Do you have a piece of code we can run that repos the problem? > > Also, have you seen the lexical require Upgrade Notification? http://rakudo.org/2017/03/18/lexical-require-upgrade-info/ > > my $m = 'Test'; > require ::($m) <&ok>; > ok 1, 1; > # OUTPUT: ok 1 - 1 > > my $m = 'DBIish'; > require ::($m); > my $o = ::($m).new; > dd $o; > # OUTPUT: DBIish $o = DBIish.new
Date: Mon, 17 Apr 2017 19:38:58 +0200
To: perl6-bugs-followup [...] perl.org
Subject: Re: [perl #131168] problems when using require ::($m)
From: mt1957 <mt1957 [...] gmail.com>
Download (untitled) / with headers
text/plain 2.4k
I understand that the symbols must be used in the same block as the require statement. There is then still a problem, namely the difference between linux and windows. In the mean time I will try to get the usage of the functions to the block where it is required. Marcel Show quoted text
> On 17-04-17 19:12, Zoffix Znet via RT wrote: > > thanks for the link, I will look into it. > > The code for which the windows implementation fails but not on linux, > can be found here; > > https://github.com/MARTIMM/config-datalang-refine/blob/master/lib/Config/DataLang/Refine.pm6 > > the requires are at line 57 and 64 > and the error is thrown at line 193 where the function is used. > > thanks again, > Marcel >
>> On Mon, 17 Apr 2017 09:53:28 -0700, mt1957@gmail.com wrote:
>>> Since I've installed perl6 version 2017.03-234-g0ebdaa4 built on MoarVM >>> version 2017.03-128-gc9ab59c, several modules are experiencing failures >>> when using the following construct (golfed down)(I am sure that the >>> module loads) >>> >>> >>> my $m = 'somemodule'; >>> require ::($m); >>> my $o = ::($m).new; >>> >>> >>> However, in a simple setup it works fine. I could manage to rewrite >>> things in such a way that errors disappear, but I do not understand it. >>> A question is 'Are the symbols loaded lexically in such a way that it is >>> not possible to instantiate the class in another method?' >>> >>> A remaining bug on windows(with latest rakudostar) shows the error; >>> >>> Failed to load Config::TOML; >>> Lexical with name '&from-toml' does not exist in this frame >>> >>> when using something like the following >>> >>> my $m = 'Config::TOML'; >>> require ::($m) <&from-toml>; >>> >>> see also >>> https://ci.appveyor.com/project/MARTIMM/config-datalang-refine/branch/master >>> >>> >>> Other things I've seen before are; not able to find the class name >>> symbol when I want to instatiate the class, or the .^name is shorter >>> than the real class name should be, which accounts for the first error. >>> >>> >>> Regards, >>> Marcel >>> >>>
>> Can't reproduce either of the issues you describe. Do you have a piece of code we can run that repos the problem? >> >> Also, have you seen the lexical require Upgrade Notification? http://rakudo.org/2017/03/18/lexical-require-upgrade-info/ >> >> my $m = 'Test'; >> require ::($m) <&ok>; >> ok 1, 1; >> # OUTPUT: ok 1 - 1 >> >> my $m = 'DBIish'; >> require ::($m); >> my $o = ::($m).new; >> dd $o; >> # OUTPUT: DBIish $o = DBIish.new


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

For issues related to this RT instance (aka "perlbug"), please contact perlbug-admin at perl.org