3 ms·
Another reason for "code as data" is to enable (safe) remote code execution via RPC. For example you may want to query a database with a custom filter predicat
by andyferris 5y ago
Another reason for "code as data" is to enable (safe) remote code execution via RPC.
For example you may want to query a database with a custom filter predicate function. If you pass one of BLisp's `Pure` functions across the wire, the database could execute the function with relative safety (compared with using `eval` with a string, or whatever).
I find it frustrating that almost all popular languages lack any safe facility for this, so people have to create some limited query schema (with it's own custom wire encoding and mini-interpretter), or instantiate a sandbox for a non-pure language like Lua and eval a string, or else invent their own fully-blown programming language along the lines of BLisp.
- bvrmn 5y agoI don't see a difference between (eval s-expression) and eval("some code"). `eval` is inherently insecure without special restricted runtime. Pureness doesn't guarantee security.
- elcritch 5y agoOne side benefit of wasm appears to be enabling this scenario, but across many languages. The client gets to use almost any language they want, it's fast, and the wasm engines let's the service define a very specific api surface.