-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Refactor code into packages #41
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
Comments
I've started this on my |
Summary of my changes:
Issues:
I've bootstrapped it to the same branch of |
Circular imports have been a problem earlier as well. Much of the code was ported from Alore, and Alore places few restrictions on circular imports. Why can't we use things like Here are a few more potential ways of dealing with circular imports:
|
I tried
I suppose the reason this feels ugly is that circular imports are more What if we rewrite On 28 January 2013 09:44, Jukka Lehtosalo [email protected] wrote:
|
Ah, now I see. It seems that
Quick testing indicates that this works. However, it adds
(The above has not been tested, though.) Not sure which of the transformations is the better approach. In any case, we should probably only do the transformations if there actually are cyclic imports. |
Here are some ideas. Statically typed code tends to make heavier use of circular imports, but they primarily affect type declarations. However, I think that in this case it's better to refactor the code to use (fewer) circular imports. But this should be done as a separate task after the refactorings have been merged into master. Later on, we may decide to add better support for circular imports in the Python back end as another separate task. So I suggest we proceed like this:
|
When you refer to refactoring in the first step, do you mean refactoring On 1 February 2013 12:34, Jukka Lehtosalo [email protected] wrote:
|
Yes, I mean only the original refactoring into packages. |
The other refactoring (removing circular imports) is now issue #93. |
I'm going to rename mtypes to types. Then we can close the issue. |
Currently the implementation does not use packages, because the Python translator does not support them yet (#24). Refactor the implementation to use packages.
The first step could be to translate all modules m into modules mypy.m (e.g. mypy.build). Later on, we could use a deeper hierarchy (e.g. mypy.checker.expressions, mypy.transform.functions).
Also rename mtypes to mypy.types (the name mtypes was used to avoid name clash with the types module).
The text was updated successfully, but these errors were encountered: