google / starlark-go

Starlark in Go: the Starlark configuration language, implemented in Go
BSD 3-Clause "New" or "Revised" License
2.27k stars 204 forks source link

Serialization of functions possible? #380

Closed clayscode closed 3 years ago

clayscode commented 3 years ago

Would it be possible at all to support the serialization of functions via something like Gob? I tried naively to just make all fields on starlark.Function exported, including all fields on sub elements, but when I tried to serialize it, I just ended up with a stack overflow

adonovan commented 3 years ago

This requires cooperation from every data type in the heap, which means it requires a new method on the Value interface, which would be a breaking API change, which, in short, means no, it would not be possible.

clayscode commented 3 years ago

Well it was worth a shot 😅. Thanks! I'll close this issue then.