Replies: 3 comments 6 replies
-
You first described the way you might currently use selector call expressions, and then skipped directly to describing "solutions". Can you describe what the problem it is that you're trying to "solve"? |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
IMO the "only functions" approach makes the thought process simpler. You just don't need to think "do I need to make it a method or a function?" As an alternative, it can be a good feature for odin lsp ( |
Beta Was this translation helpful? Give feedback.
-
At the moment there are 3 steps necessary to use the syntax sugar of selector call expressions "->":
See example below:
Solution 1):
Allow default values in the struct for all types. This would reduce Pt. 3) above.
Solution 2):
Use the definition/implementation of the proc outside a struct as a member ot the sruct, if the first parameter in the proc is a pointer to a struct in the package . This would reduce Pt. 1 and Pt. 3.
I think Solution 2) would offer benefits without to break consistency and it is not an typical OO-design. You can still use the proc in common way. The first parameter name "this" could be mandatory if it fits design of Odin.
Beta Was this translation helpful? Give feedback.
All reactions