Closed OfekShochat closed 2 years ago
Well, I actually tried something like this in my on fork, in a branch called ast_serde
. It is very old though.
https://github.com/schungx/rhai/tree/ast_serde
At half ways, I realized that there really is no point in doing this, as persisting the original script is easier and quicker than generating a string serialization from an AST
.
Therefore, the standard way is to persist the script text itself (which can be compressed easily if you're really pressed for space).
Parsing is reasonably fast so text -> AST
shouldn't be a problem if you do it every time. It is certainly not going to be more costly than deserializing with serde
.
sure, cool (not going to deserialize it every time tho, I have a cache that is initialized from a db)
hello! Im trying to cache asts but I don't see any way to do this. I don't think #161 is finished, but idk. is there any standard way of doing this or should I try and take all the info and then reconstruct the ast? thanks! ps great project