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

Generalize readonly #255

Closed
ThePhD opened this issue Oct 26, 2016 · 1 comment
Closed

Generalize readonly #255

ThePhD opened this issue Oct 26, 2016 · 1 comment
Assignees
Labels
Bike.Shed WHY IS THE TAG GOLD I WANTED TO PAINT IT RED--
Milestone

Comments

@ThePhD
Copy link
Owner

ThePhD commented Oct 26, 2016

Currently, people think that sol::readonly will work on any arbitrary object they set into a table (as per #254). It would be highly beneficial to have a readonly marker for making a whole table read-only, or to at least provide an example in the sol2 examples on how to perform this kind of operation so people understand it better.

@ThePhD ThePhD self-assigned this Oct 26, 2016
@ThePhD ThePhD added this to the Bike.Shed milestone Oct 26, 2016
@ThePhD ThePhD added the Bike.Shed WHY IS THE TAG GOLD I WANTED TO PAINT IT RED-- label Oct 26, 2016
@ThePhD
Copy link
Owner Author

ThePhD commented Nov 4, 2016

Unfortunately, we cannot generalize readonly. This would require use to essentially sweep the contents out from under the user, and ultimately screw them over in cases where they set a table as readonly but aren't done working with it or other cases where users would find the behavior unexpected. It also hijacks the __index function, which would make it unintuitive for when a user sets multiple things.

Therefore, it is beneficial to either invest in a table.create_readonly() function or something else. For the time being, documentation will suffice: http://sol2.readthedocs.io/en/latest/api/readonly.html

@ThePhD ThePhD closed this as completed Nov 6, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bike.Shed WHY IS THE TAG GOLD I WANTED TO PAINT IT RED--
Projects
None yet
Development

No branches or pull requests

1 participant