from module1/views import App1View
from module2/views import App2View
Causes Error: redefinition of 'views'
Which is clear but seems odd because I'm specifying what I want to import (I don't want anything else). And yes, I know that this is a feature.
But I'm here to ask a few things:
I think this could cause a lot of conflicts, specially while designing modular applications.
indeed, this is a known bug.
Last time I spoke with Araq he said he would fix it. This is an even bigger problem in the context of babel packages because it may be very common that you want to import a 'utils' module from two different packages.
As far as I know, the only way that you can get around this is to prefix your module with something unique.
Are there ideas to make full qualification be "module1.views" instead of "views" in the future?
I think that will come once this is fixed, since resolving conflicts would be impossible otherwise.
Very nice. This would solve the problem. :)
What's the point in having full qualification even using the "from ... import" statement?
It's not a bug. However since everybody loves "universe.earth.programming.languages.nimrod.package.utils" you'll get it.
But beware: Wie man sich bettet, so ruht man.
("You've made your bed and you'll have to lie in it.")
I think a cleaner solution would be to allow for renaming of imported modules, e.g.:
import module1/view as view1
import module2/view as view2
This would allow for disambiguation without ultra.long.symbol.prefixes.
I like the way Jehan suggested, for the "import ..." statement.
For the "from ... import ..." statement I think that the access through full qualification can cause misunderstandings. When I could just see at headers and conclude what exactly is being used.
from module1/view import only view1, foo
from module2/view import only view2, bar
from module1/view import only view as view1, foo
from module2/view import only view as view2, bar
I've implemented:
import path1/view as view1
import path2/view as view2
Also you can now use '.' instead of '/':
import path1.view as view1
import path2.view as view2
from x.y as z import nil
Only module names can be aliased with 'as'.