Is it posible to serialize a Makie.Figure object?

I’ve tried with JLD2 and Serialization. InJLD2, the warnings were, it can’t save anonymous functions, while Serialization errored with “cannot serialize a running Task”. So probably no chance?

This is the context.

Never occurred to me and I won’t bother dumping through a Figure to find the root causes, but it’s not surprising to run into this with complicated objects. Serialization in general is intended for simpler, well-contained objects and their composites, and it can’t be done safely or at all for others. It’s worth pointing out that Serialization also warns against storing anonymous functions long-term, especially across even minor code changes, so user inputs of anonymous functions is fundamentally a problem. If another way to save the necessary information to instantiate a Figure’s copy is developed, I’d expect some limitation on that front.

Makie objects generally contain a lot of anonymous functions, so I wouldn’t expect them to serialize well.

Also, any serialization would break whenever any package that Makie depends on, or Makie itself, changes - which is fairly often!