The point is that sometimes you really *don't* want the closure to be send-able, because you want it to access from the surrounding context both owned pointers (-> be called-once) _and also_ borrowed pointers (-> be stack-allocated). This is vital for some use cases and is impossible today (ok, possible by painfully wrapping a cell around each owned pointer and taking its value in the stack closure).
On Tue, Dec 31, 2013 at 4:20 PM, Daniel Micay <[email protected]> wrote: > On Tue, Dec 31, 2013 at 9:15 AM, Oren Ben-Kiki <[email protected]> wrote: > > Not to re-ignite the thread about this, but one way `proc`s aren't > > sufficient because they are send-able (that is, allocated on the heap). > Rust > > lacks a call-once stack-allocated closure types, which are immensely > useful > > for manipulating container elements, creating DSL-ish syntax, etc. > > > > That's separate from the `decltype` issue, though. > > Closures don't need to be heap-allocated to be `Send`. An unboxed > closure with only `Send` captures would be `Send` itself too. >
_______________________________________________ Rust-dev mailing list [email protected] https://mail.mozilla.org/listinfo/rust-dev
