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

Owner: Nobody
Requestors: masak <cmasak [at] gmail.com>
Cc:
AdminCc:

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



Subject: [BUG] .wrap and 'is export' don't play along in Rakudo
Date: Tue, 10 Jan 2012 11:15:50 +0100
To: rakudobug [...] perl.org
From: Carl Mäsak <cmasak [...] gmail.com>
Download (untitled) / with headers
text/plain 1.1k
<tadzik> about wrap again: https://gist.github.com/1585730 Included here for completeness: ┌─[tadzik@yavin4]─[~/src/perl/bailador] (master)* └─[%]─> cat lib/Bailador.pm module Bailador; our sub our_template { return "(our template)" } sub exp_template is export { return "(exp template)" } sub hook is export { &our_template.wrap: { "wrapped {callsame()}" }; &exp_template.wrap: { "wrapped {callsame()}" }; } ┌─[tadzik@yavin4]─[~/src/perl/bailador] (master)* └─[%]─> cat examples/app.pl use Bailador; sub foo { say Bailador::our_template(); say exp_template(); } hook(); foo(); ┌─[tadzik@yavin4]─[~/src/perl/bailador] (master)* └─[%]─> perl6 examples/app.pl wrapped (our template) (exp template) <masak> tadzik: looks like a bug to me. <tadzik> S11 uses the word "binding" when it comes to exportation, this looks more like copying <masak> tadzik: haven't read what S11 says about it, but binding makes a lot of sense and copying doesn't. S11:137: Importing via C<use> binds into the current lexical scope by default <masak> tadzik: will you submit a rakudobug, or shall I? <tadzik> masak: go on * masak submits rakudobug
Download (untitled) / with headers
text/plain 1.2k
On Tue, 10 Jan 2012 02:16:07 -0800, masak wrote: Show quoted text
> <tadzik> about wrap again: https://gist.github.com/1585730 > > Included here for completeness: > > ┌─[tadzik@yavin4]─[~/src/perl/bailador] (master)* > └─[%]─> cat lib/Bailador.pm > module Bailador; > > our sub our_template { > return "(our template)" > } > > sub exp_template is export { > return "(exp template)" > } > > sub hook is export { > &our_template.wrap: { "wrapped {callsame()}" }; > &exp_template.wrap: { "wrapped {callsame()}" }; > } > ┌─[tadzik@yavin4]─[~/src/perl/bailador] (master)* > └─[%]─> cat examples/app.pl > use Bailador; > > sub foo { > say Bailador::our_template(); > say exp_template(); > } > > hook(); > > foo(); > ┌─[tadzik@yavin4]─[~/src/perl/bailador] (master)* > └─[%]─> perl6 examples/app.pl > wrapped (our template) > (exp template)
This bug is still present in current Rakudo: This is Rakudo version 2017.08-104-g76f1d8970 built on MoarVM version 2017.08.1-148-g1059eed1 implementing Perl 6.c. (Test script now needs s/module/unit module/ to run, but then produces the same result.) Calling `&exp_template.WHICH` also confirms that the one in the module and the one in the mainline scope are different objects.


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