You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Does it make sense to have a FunctionN type class (with N from 0 to, say, 8) with a call(arg0,..., argN) method, and have the closure be compiled to a struct of the closed over variables? So a lambda would be linear iff it uses linear variables.
Main issue I can see is that iirc this requires actual type inference
So, my (very brief and compressed) thoughts on this:
Typeclasses do static dispatch. In a sense that's "all you need". But unless you want every type and function to be generic (with the associated compilation cost), you usually want a way to do dynamic dispatch. There's two ways to do this, broadly:
Closures
Lightweight OOP
I have some thoughts (which I hope I wrote down somewhere) on how to do this while preserving the soundness of the linear type system. It is possible. I just haven't worked on implementing this yet, because I think having a usable/practical stdlib and basic tooling is more valuable than this feature at present.
Closures, or some light OOP.
The text was updated successfully, but these errors were encountered: