
June 23, 2022
10:26 a.m.
Interesting point, it's not something I thought of. One solution as mentioned by Simão, and what I had in mind, is to pull the type from the first parameter of the function. We know that the function is always going to have minumum 1 parameter, and the value is always passed as the first argument. One downside is that it isn't very transparent to the user - they might not understand that the type is being taken from the first argument of the function, and wonder where it is coming from, in which case, the other solution would be to do something like `InitVar` but that takes two types (the return and the init type); something like `var: InitFn[int, str]` for the `chr` example.