-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
[TODO] deprecate import foo
for import ./foo
when foo is relative to importing file and not in --path
#8608
Comments
Something similar was suggested before. Since we now have the |
Indeed; I agree with everything @yglukhov said in that post and in later replies in same thread. to quote what he said:
|
Personally I find the following Python module syntax quite handy for this particular case and it's crystal clear of what it does: from .moduleY import spam
from .moduleY import spam as ham
from . import moduleY
from ..subpackage1 import moduleY
from ..subpackage2.moduleZ import eggs
from ..moduleA import foo
from ...package import bar
from ...sys import path You can read read pep-0328 for more information. |
This has been solved by putting all new modules in Nim's stdlib in Personally I don't think the way it works is surprising. AFAIK Python works in the same way and people are generally happy with its module system. |
I think it's right to close this discussion already because we've had many discussions surrounding this before. |
import foo
for import ./foo
when foo is relative to importing file and not in --pathimport foo
for import ./foo
when foo is relative to importing file and not in --path
given
nim c bar/main.nim
is allowed to match tobar/foo.nim
andfoo.nim
even thoughbar/
is not in --path.this can lead to surprising results and should be deprecated.
proposal:
import foo
shall only match to afoo.nim
in the search path.import ./foo
The text was updated successfully, but these errors were encountered: