The original goal of the AST was for it be me fully JSON serializable. The one place I deviated from that goal was to allow RegExp values. This was to improve efficiency and it seemed reasonable because it's fairly easy to convert a RegExp to a string and back to JSON with builtin tools.
However, it didn't occur to me when I added the plugin system that I was adding something that isn't serializable. We need to figure out something to fix that.
I think the minimum we need to do is to give plugins an identifier. That would allow a hook for a JSON.stringify replacer to store something that can be used to restore the plugin. The application implementing serialization will need to maintain a plugin registry for the plugins they support mapping the identifier to the plugin, but that shouldn't be be challenging.
The original goal of the AST was for it be me fully JSON serializable. The one place I deviated from that goal was to allow
RegExpvalues. This was to improve efficiency and it seemed reasonable because it's fairly easy to convert aRegExpto a string and back to JSON with builtin tools.However, it didn't occur to me when I added the plugin system that I was adding something that isn't serializable. We need to figure out something to fix that.
I think the minimum we need to do is to give plugins an identifier. That would allow a hook for a JSON.stringify replacer to store something that can be used to restore the plugin. The application implementing serialization will need to maintain a plugin registry for the plugins they support mapping the identifier to the plugin, but that shouldn't be be challenging.