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

Importing the same thing twice shouldn't bomb #3150

Closed
p6rt opened this issue May 28, 2013 · 6 comments
Closed

Importing the same thing twice shouldn't bomb #3150

p6rt opened this issue May 28, 2013 · 6 comments

Comments

@p6rt
Copy link

p6rt commented May 28, 2013

Migrated from rt.perl.org#118231 (status was 'resolved')

Searchable as RT118231$

@p6rt
Copy link
Author

p6rt commented May 28, 2013

From @lizmat

[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_ (~stevan_@​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 (~sqirrel@​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

@p6rt
Copy link
Author

p6rt commented Nov 14, 2013

From @lizmat

This appears to have been fixed.

@p6rt
Copy link
Author

p6rt commented Nov 14, 2013

The RT System itself - Status changed from 'new' to 'open'

@p6rt
Copy link
Author

p6rt commented Oct 16, 2014

From @usev6

Since it's now possible to import the same thing twice, I added a test to S11-modules/import.t with the following commit​: Raku/roast@02a309ec81 and I'm closing the ticket.

1 similar comment
@p6rt
Copy link
Author

p6rt commented Oct 16, 2014

From @usev6

Since it's now possible to import the same thing twice, I added a test to S11-modules/import.t with the following commit​: Raku/roast@02a309ec81 and I'm closing the ticket.

@p6rt p6rt closed this as completed Oct 16, 2014
@p6rt
Copy link
Author

p6rt commented Oct 16, 2014

@usev6 - Status changed from 'open' to 'resolved'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant