3 ms·
Note that although serializing simple values (like numbers and symbols) to urls works, serializing big data doesn't work because urls have a length limit. What
by jules 18y ago
Note that although serializing simple values (like numbers and symbols) to urls works, serializing big data doesn't work because urls have a length limit.
What I was trying to explain is a system that stores the data on the server and passes pointers to this data to the client. Web applications that use databases already work this way. The id/primary key column of a database table is the pointer.
To serialize a closure you generate ids for the values of the free variables. Then you save the values in a hash table and send the ids to the client (instead of the actual values). To deserialize a closure you fetch the free variables from the hash table.
This system doesn't work yet because this hash table keeps growing. Every time you serialize a closure you put the free variables in the hash table. This is wasteful because some of the values might already be in the hash table. This is simple to fix; just look if the value is in the hash table, and if it is you return the existing id (this can be done efficiently by having two hash tables: ids->values and values->ids).
- almkglor 18y ago> What I was trying to explain is a system that stores the data on the server and passes pointers to this data to the client. What I was trying to explain was to make this seamless to the programmer, i.e. the programmer doesn't have to use a let-like form listing the variables he or she wants to use, he or she just uses them. Basically the base system scans through the enclosed variables, checks if they're trivial, and encodes them directly if so; if not, it puts the data for retrieval somewhere. Mostly I'm concentrating on keeping Arc succint, and modifying the base system without, if possible, modifying higher-level code. In any case your suggested implementation does look good. > if it is you return the existing id (this can be done efficiently by having two hash tables: ids->values and values->ids). http://arclanguage.com/item?id=3858 http://arclanguage.com/item?id=3858