Skip to content

Conversation

@ElectricalBoy
Copy link
Collaborator

Summary

This PR adds BaseClass.super().

How did you test this change?

included tests

Copy link
Collaborator

@hjpalpha hjpalpha left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what are the perf implications of this?

@ElectricalBoy
Copy link
Collaborator Author

what are the perf implications of this?

negligible: see leagueoflegends:User:ElectricalBoy/Sandbox/PerfTest1 and leagueoflegends:User:ElectricalBoy/Sandbox/PerfTest2

@mbergen
Copy link
Collaborator

mbergen commented Jan 22, 2026

What's the usecase for this?
In case of single level inheritance like in the linked PR, you imported the Base anways, and could do

function Child:fun()
    return Base.fun(self)
end

to call an overridden function of the Base, right?

@ElectricalBoy
Copy link
Collaborator Author

What's the usecase for this? In case of single level inheritance like in the linked PR, you imported the Base anways, and could do

function Child:fun()
    return Base.fun(self)
end

to call an overridden function of the Base, right?

function Child:fun()
	return self:super():fun()
end

I think that this is more readable as it clearly shows with super that the method of parent class is called; I mean, it's a widely used keyword in OOP already.
Also, I think Base.fun(self) really is a workaround for absense of super in our Class implementation

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants