-
Notifications
You must be signed in to change notification settings - Fork 824
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
Add extend to imports #283
Conversation
@@ -41,7 +41,13 @@ impl IsExport for Export { | |||
/// } | |||
/// ``` | |||
pub struct ImportObject { | |||
map: Rc<RefCell<HashMap<String, Box<dyn LikeNamespace>>>>, | |||
map: Rc<RefCell<HashMap<(String, String), Box<dyn IsExport>>>>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Main issue with this is that we need to keep imported instances alive. I'm not sure the best way to do this, however.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, I'm not familiar enough with the code base yet to understand how this change affects the lifetimes of the Exports. It seems like it should be the same, unless you mean that we were dropping entries by namespace before 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, the Box<dyn LikeNamespace>
could contain an Instance
. When getting a function pointer from an ImportObject
, if the Instance isn't maintained in the ImportObject
, the function pointer will dangle.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, it's possible to use two maps and check both to emulate a global name lookup.
Though, I'm still a bit unclear on the ownership... ImportObject
s own Instance
s and Instance
s own ImportObject
s?
Closing this in favor of #286 |
resolves #258 (early draft)