Open vasslitvinov opened 4 years ago
@mppf @bradcray @benharsh what do you think about this idea?
@vasslitvinov - I think this is an interesting idea but I would expect it to have different syntax. As you pointed out, we would need a way to make things like var x: T
work. That leads my thinking to some kind of decorator for the function or some of its arguments or some kind of block statement.
However I think the main question here is this - is it the common case that unconstrained generics will need this behavior? In that case, what do we gain by requiring users to opt in (almost all the time)?
One way to modify our current POI rule is to require users to opt into it. By default it would not apply. To opt in, provide some syntax to add to the call, for example akin to try-expressions or a keyword-like receiver.
Benefits:
No change:
Downside: