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

Proposal: Keep get{FieldName} function in the single value table #1319

Closed
CrazyNorman opened this issue Aug 17, 2023 · 3 comments · Fixed by #1550
Closed

Proposal: Keep get{FieldName} function in the single value table #1319

CrazyNorman opened this issue Aug 17, 2023 · 3 comments · Fixed by #1550
Assignees

Comments

@CrazyNorman
Copy link

Now if the table has only one filed in the schemas, the get{FileName} and set{FiledName} function will be removed from the table code generating. However this can cause code refactoring when I add one filed in the shema. Maybe we can reserve the get{FileName} and set{FiledName} to avoid this troublesome. The extra gas cost for reserve these two functions should be acceptable.

@dk1a
Copy link
Contributor

dk1a commented Aug 17, 2023

I think more functions should be free gas-wise, they aren't kept because that'd double the functions in table lib making it harder to read/use (there're more methods than set/get, and with 1-field tables just using get/read/push/pop/... is really convenient imo).
But I agree that at least a config option to force the postfixes in 1-field tables, so they're like multi-fields ones (for ppl planning to potentially add more fields) would be useful

@CrazyNorman
Copy link
Author

Yes, having a config option to control the function convention will be very helpful. It is very common you define a table config with single value at first then add a field later during the development process.

@holic
Copy link
Member

holic commented Aug 20, 2023

Just ran into this when prototyping a thing, and I agree that it would be clearer if we kept getField methods.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Development

Successfully merging a pull request may close this issue.

4 participants