Skip to content
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

Feature Request: The ability to serialize functions/closures #5514

Closed
gopherbot opened this issue May 18, 2013 · 4 comments
Closed

Feature Request: The ability to serialize functions/closures #5514

gopherbot opened this issue May 18, 2013 · 4 comments

Comments

@gopherbot
Copy link
Contributor

by kellrott:

Feature Request: The ability to produce some form of serialized closure that can be
transmitted to remote computers. This ability would make it much easier to design
distributed computing APIs.
@minux
Copy link
Member

minux commented May 18, 2013

Comment 1:

how about shared data?
func test() {
  x := 0
  f := func() { x++ }
  // ..
}
if you serialize f in test() and send it to remote machine
and execute it three times, should x in the origin machine
change?
i don't think we can implement this in the general case.
please also consider the architecture of the remote machine
might not be the same.

@gopherbot
Copy link
Contributor Author

Comment 2 by kellrott:

In practice all the only values the make it back to the origin machine are those
returned by the function. 
You can see this in practice at http://spark-project.org/ (Scala based). And python
closure serialization can be found at
http://pydoc.net/Python/cloud/2.3.9/cloud.serialization.cloudpickle/
As for machine architecture, distributed compute clusters tend to be homogeneous. If the
architecture doesn't match, then an error could be returned.

@cznic
Copy link
Contributor

cznic commented May 19, 2013

Comment 3:

Not feasible at runtime. Perhaps the source form can help sometimes.
#Unfortunate

@ianlancetaylor
Copy link
Member

Comment 4:

I can't see this ever being implemented in the language or the standard libraries.  I
can imagine specific implementations in specific packages, but they would not in general
work with arbitrary functions, or they would only work when interpreted, not compiled.

Status changed to Unfortunate.

@golang golang locked and limited conversation to collaborators Jun 24, 2016
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants