-
Notifications
You must be signed in to change notification settings - Fork 239
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
Using pl.Map with keys equal to method names #188
Comments
Yes, it's a known problem, because the lookup cannot distinguish between the table and the metatable __index. Now we could make this bullet proof at the cost of performance - make __index a function and put some logic in it. For pl.Set I resolved the issue by having no methods. |
I'll leave this open, but I'm concerned about the performance implications. |
Would it work for the Map table to store its key-value pairs in a separate table, like self.contents? That way the contents would never conflict with the methods. |
This might not be a real bug report. It could easily be my fault in that I'm using pl.Map in the wrong way.
Consider the following code:
This fails with the error
That's not surprising: the key "get" shadows the method. But does this mean that the map is now unusable (at least the "get" method) until "get" is deleted?
The text was updated successfully, but these errors were encountered: