Skip to content
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

Is there any reason to keep xxx.submodules? #12

Closed
nmigen-issue-migration opened this issue Dec 18, 2018 · 3 comments
Closed

Is there any reason to keep xxx.submodules? #12

nmigen-issue-migration opened this issue Dec 18, 2018 · 3 comments
Labels

Comments

@nmigen-issue-migration
Copy link

Issue by mithro
Tuesday Dec 18, 2018 at 00:37 GMT
Originally opened as m-labs/nmigen#10


A huge number of issues in the old migen are caused by forgetting to assign something to xxx.submodules.

Is there any reason that we can't do something like this?

class Module:
    def __setattr__(self, k, v):
        if isinstance(v, Module):
           self.add_module(k, v)
        object.__setattr__(self, k, v)
@nmigen-issue-migration
Copy link
Author

Comment by whitequark
Tuesday Dec 18, 2018 at 00:38 GMT


You do not inherit from Module in nMigen.

@nmigen-issue-migration
Copy link
Author

Comment by whitequark
Tuesday Dec 18, 2018 at 00:52 GMT


And incidentally the reason you don't is this.

@nmigen-issue-migration
Copy link
Author

Comment by whitequark
Tuesday Dec 18, 2018 at 00:57 GMT


Also, see #3--in nMigen forgetting to add a submodule will be a hard error, though I'm not yet sure exactly how this will be detected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

1 participant