# New Ticket Created by Elizabeth Mattijsen # Please include the string: [perl #118231] # in the subject line of all future correspondence about this issue. # <URL: https://rt.perl.org:443/rt3/Ticket/Display.html?id=118231 >
[23:47:51] <lizmat> given a file A.pm with: module A:version<v1> { sub a is export { say "a" } }; module B:version<v1> { sub b is export { say "b" } } [23:48:26] stevan_ (~stev...@c-75-69-127-112.hsd1.ma.comcast.net) left IRC. (Remote host closed the connection) [23:48:52] <lizmat> use A; a; b; import B # currently fails because it tries to import "b", whereas the "use A" already did that also [23:49:32] <lizmat> even though they are the same sub [23:50:04] sqirrel (~sqir...@brln-4db94d7a.pool.mediaways.net) left IRC. (Quit: Verlassend) [23:50:12] <lizmat> is the fact that "use A" exports the subs from module B a rakudobug, or is that a case of "don't do that" ? [23:50:46] <jnthn> Well, you're importing the stuff from EXPORT::DEFAULT [23:50:52] <jnthn> And "is export" installs the things in there [23:51:01] <lizmat> Feels to me that we should maybe disallow more than one module / class etc. at the top level of a UNIT to prevent these type of situations? [23:51:11] <jnthn> Nah. [23:51:31] <jnthn> It's common to do that. Especially if one of them is a lexical class that you're using as an implementation detail [23:51:46] <lizmat> I'm not against that [23:51:57] <lizmat> that's lexical inside, and hidden from the outside [23:52:31] <lizmat> it's just that there is a difference between "use A" and "import A" in the case of 2 top level modules with exportable subs [23:52:32] <jnthn> I thought we didn't complain about importing the same things twice, though... [23:52:35] <jnthn> r: use Test; use Test; [23:52:36] <+camelia> rakudo 25a0b3: OUTPUTĀ«[31m===[0mSORRY![31m===[0mā¤Cannot import the following symbols from Test, because they already exist in this lexical scope: &skip_rest, &diag, &done_testing, &doneā¤at /tmp/zuyxQPOgEB:1ā¤------> [32muse Test; use Test[33mā[31m;[0mā¤Ā» [23:52:46] <jnthn> Ah, hm. [23:52:59] <lizmat> so maybe that's the rakudobug ? [23:53:10] <jnthn> I'm a bit surprised it complains there. [23:53:19] <jnthn> Especially as I thought I'd fixed that in the past... [23:53:43] <lizmat> ok, then I'll submit a rakudobug for this and we can look at this later [23:53:52] <lizmat> is that a plan? [23:54:02] <jnthn> Sure