-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Serializable Lambda expression #1022
Comments
See also #668. |
One could do add some compiler magic to support arbitrary object serialization in Rust, with the caveat that such an object can only be deserialized by the same program. This would be like But the downside of this is that the user has no control over the serialization protocol, and it would require making a serializer that works over arbitrarily complicated types, even though much of it could be done outside of the standard library. A more flexible approach would be to expose two new mechanisms to Rust:
Edit: no need store a separate function pointer since the closure type itself would suffice. |
Any updates on it? With write spark like system in rust, |
(python's pickle does not serialize functions' code to a wire format; it only serializes the name of a function.) |
@habnabit but you can implement it easier,see https://github.com/douban/dpark/blob/0.5.0/dpark/serialize.py#L250 |
I created a crate If the resulting serializable closure is upcast to |
Interesting. I had tried a similar idea a while back but deemed it too questionable for production use. |
@Rufflewind Yes, thanks for your crate, it was good inspiration for serde_traitobject. I just made a rust PR that would make serde_traitobject safe: rust-lang/rust#66113. Keen to hear if you have any thoughts! |
Rust basically is very strong for parallel programming. If Rust supports Serializable Lambda expression, it would be very strong even for distributed programming.
Here was a little discussion.
rust-lang/rust#23759
Python and Java 8 already have similar concepts as follows:
The text was updated successfully, but these errors were encountered: