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? #10

Closed
mithro opened this issue Dec 18, 2018 · 3 comments
Closed

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

mithro opened this issue Dec 18, 2018 · 3 comments
Labels

Comments

@mithro
Copy link

mithro commented Dec 18, 2018

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)
@whitequark
Copy link
Contributor

You do not inherit from Module in nMigen.

@whitequark
Copy link
Contributor

And incidentally the reason you don't is this.

@whitequark
Copy link
Contributor

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
Projects
None yet
Development

No branches or pull requests

2 participants