by killercup · 7y ago · 0 comments
- Hide the fields of your struct to not break your users when adding/changing fields
- automatically convert data in your setters (accept a reference to a string even though you want to store a file system path)
- use type parameters to conditionally set and validate values at compile time (by making your data type generic and implementing some setters so that they return a concrete value for that allowing you to write _different_ setters based on that type)
- by using the session type pattern to disallow incorrect method calls at compile times (e.g. calling `set_content` after calling `submit`)
No comments yet.