Closed lkarsten closed 6 years ago
We need to decide what "identical" and "colliding with" means, but otherwise no objection.
In VCP we ignore the second import
, and it can't have from
specifier.
IOW:
import <something>
multiple times should be permitted (subsequent imports ignored).import <something> from <somewhere>
should fail if <something>
is already imported, with or without a path.IIRC, that's what we do, yes. Want the patch?
@gquintard please!
Why the restriction on "from ..." ?
If the two .so files are the same, why does it matter that one was found with "from ..." ?
I think the challenge is how do you know the 2 .so files are identical? The easy way to do this is to only allow from
on the first use of import.
I think for simplicity we should not compare if the two .so files are identical. Instead we should allow the first import and simple ignore subsequent imports for the same module (much as python does).
For import <something> from ...
I think it makes sense to have a stricter approach; mixing both or having import <something> from ...
multiple times does not help with readability and makes debugging harder for users. This is one of the cases where we should draw the line IMO.
Implemented in cb3cc7b39a45119d62cebc0d9bcc41c32582737b.
I use the autogenerated vmod "file_id" as oracle for identity.
(also for other vmods)