Skip to content

Store class in closures to allow super super calls - #301

Open
Uks2 wants to merge 1 commit into
ThakeeNathees:masterfrom
Uks2:super-super
Open

Store class in closures to allow super super calls#301
Uks2 wants to merge 1 commit into
ThakeeNathees:masterfrom
Uks2:super-super

Conversation

@Uks2

@Uks2 Uks2 commented Jan 4, 2026

Copy link
Copy Markdown

This changes how the parent class is found when doing super calls. It now uses the parent class of the function that the super call appears in, rather than the immediate parent of self. This means that you can use super in functions that are themselves called using super.

@ThakeeNathees ThakeeNathees self-assigned this Jan 4, 2026
@ThakeeNathees ThakeeNathees added the bug Something isn't working label Jan 4, 2026
@ThakeeNathees

Copy link
Copy Markdown
Owner

@Uks2 Thanks for contributing to the project!

Using the defining function’s context rather than the instance’s immediate parent makes more sense.
it brings the super behavior closer to languages like Python or Java

When performing `super()` or `super.something()` calls, the parent class
used to be found from `self`.  This would always return `self`'s
immediate parent when meant that if you called `super.x()` and then the
parent class function tried to call its `super.x()`, you would end up
just calling the same function again.

Now, the closure structure has a `Class*` field, filled in when the
function is bound, and this is used to find the parent of the method
that actually being run.
@Uks2

Uks2 commented Jan 4, 2026

Copy link
Copy Markdown
Author

That force push should fix the style error

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

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants