Skip to content

Make create_element a static method since it doesn't use self #10

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

Closed
wants to merge 1 commit into from

Conversation

nnabeyang
Copy link
Contributor

This change removes the unused self parameter from the create_element method and makes it a static method instead. Since create_element doesn't rely on any instance-specific state, there's no need to call it through self.

@d0iasm
Copy link
Owner

d0iasm commented Jun 29, 2025

Thank you for your PR.

In Rust, the method with self is called "method" and the method without self but inside a class is called "associated function".
https://practice.course.rs/method.html

It's totally depending on the preference but I'd like to align with other places if we update a method to an associated function. For example, create_char method in the same file can be an associated function as well. There are many methods that don't depend on self in other classes. If we change one, I'd like to change everything.

I don't know if it's worth changing all methods in other parts so I'd keep the current implementation.
Thank you for the PR again!

@d0iasm d0iasm closed this Jun 29, 2025
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

Successfully merging this pull request may close these issues.

2 participants