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 __ to metamethods atutomatically #7

Open
DarkWiiPlayer opened this issue Dec 14, 2018 · 2 comments
Open

Add __ to metamethods atutomatically #7

DarkWiiPlayer opened this issue Dec 14, 2018 · 2 comments

Comments

@DarkWiiPlayer
Copy link
Contributor

I've noticed that metamethod names still require the __ in front of their names. I'd like to suggest changing this so the __ gets added automatically and the programmer only has to write add, tostring, etc.

@SvenMarcus
Copy link
Owner

SvenMarcus commented Dec 16, 2018

Hm I'm not sure about that. The double underscore signifies that those methods are special methods. I realize that the operators keyword also does this, but Lua developers are used to this. So I'd be changing an existing and familiar concept into something else, which would make it harder to recognize by someone who isn't using lua-pie

@DarkWiiPlayer
Copy link
Contributor Author

I can only speak for myself here, but the operators keyword makes it fairly clear that these are operators and I expect most users would still understand what's going on quite easily.

The main argument I see in favour of removing the __ is that this is really just an implementation detail; a user of the framework shouldn't need to know if the operators are implemented using metamethods (If they know Lua, they will guess that's how it works), just that it works the way it does.

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