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

Section 4.2: Rethinking #313

Open
AugustH opened this issue Sep 25, 2024 · 0 comments
Open

Section 4.2: Rethinking #313

AugustH opened this issue Sep 25, 2024 · 0 comments
Assignees

Comments

@AugustH
Copy link

AugustH commented Sep 25, 2024

Null objects must be at the end of the matching chain,
i.e., their rest must be None,
so we remove the rest parameter from the class's constructor
and pass None up to the parent constructor every time.

But the code does NOT call the parent constructor at all.

    class Null(Match):
        def __init__(self):
            self.rest = None

Calling with

    class Null(Match):
        def __init__(self):
            super().__init__(None)

does not work either: this would create a new Null() and recurses endless.

Actually the value self.rest is never used, so it could be anything. IMHO: Setting the value of None breaks the class invariant: because of the if in the constructor the value is never None. If this classes get more methods this will break and somebody has to keep all the broken parts 😁.

@gvwilson gvwilson self-assigned this Sep 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants