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
Sorry, I've been a little unreachable in the past few weeks.
This is a good question, actually. My general rule of thumb is that it is safe to use Unsafe.toLinear when the function “would have been linear if all the primitives were given the appropriate type”. But it may not be very helpful.
There is a more in-depth version of this answer, which is that a function is linear if “whenever its result is consumed exactly once, its argument is also consumed exactly once”. The difficulty with this is that it is a slightly informal definition of linearity, and I don't actually know a way to make it fully precise. That being said, given this definition, you can say that you can use Unsafe.toLinear is the function really is linear (in the consume-exactly-once sense), even if the type system can't figure it out.
Describe the bug
There doesn't seem to be any documentation wrt. this.
The text was updated successfully, but these errors were encountered: