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

add a __tostring method to every object #1534

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

thacuber2a03
Copy link
Contributor

lets you debug quickly with a stupid print() or anything like that

@thacuber2a03 thacuber2a03 changed the title added a __tostring method to every object add a __tostring method to every object Jun 21, 2023
Copy link
Member

@Guldoman Guldoman left a comment

Choose a reason for hiding this comment

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

Might be a good idea to move them to just after the :extend calls.

@thacuber2a03
Copy link
Contributor Author

eh sure whatever

@thacuber2a03
Copy link
Contributor Author

@Guldoman done :)

@Guldoman
Copy link
Member

What do you think about Adam's proposal of providing the object name as a parameter of Object:extend()?
It would solve the inconsistency of __tostring not being a metamethod.

@thacuber2a03
Copy link
Contributor Author

I'm not sure...
feels weird specifying the name of the new class in the extend method of the old class...
would the original behavior of being able to add a __tostring metamethod stay there?

@adamharrison
Copy link
Member

adamharrison commented Oct 22, 2024

As per discussion in PR committee meeting 10; should be added to extend as a __name field on the table, and extend call change to work like so:

child = parent:extend { as = "child" }

@thacuber2a03
Copy link
Contributor Author

last comment before this one was in 2023 jeez

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.

3 participants