3 ms·
Only `proc` closures were boxed, `|...| -> ...` closures were pointers into the stack. However, it is true that all closures were type erased, and were hence eq
by dbaupp 11y ago
Only `proc` closures were boxed, `|...| -> ...` closures were pointers into the stack. However, it is true that all closures were type erased, and were hence equivalent to certain trait object types (`Box<FnOnce(...) -> ...>` for `proc`, and `&mut FnMut(...) -> ...` for the pipes).
Also, functions could coerce to either of the closure types, and hence be passed straight to functions expecting them.
- Manishearth 11y ago> Also, functions could coerce to either of the closure types Huh, I recall this not working. Perhaps I made a mistake then. > closures were pointers into the stack Ah, the type erasure was through &mut. TIL; I always thought it was Box only.