endojs / Jessie

Tiny subset of JavaScript for ocap-safe universal mobile code
Apache License 2.0
279 stars 16 forks source link

named arguments idiom: passing fresh mutable objects? #111

Open dckc opened 1 year ago

dckc commented 1 year ago

I was looking at some code carefully, in particular a call using "named arguments":

addBidCommand(interCmd, { tui, makeRpcClient, agd });

Is this allowed in Jessie? Could/should it be? It's statically evident that the caller no longer has access to the object and hence cannot mutate it.

Using object destructuring for "named arguments" is, IIUC, a best practice to manage more than 2 or 3 args in a function.

Callees don't assume their args are hardened, right? Jessie functions are callable from non-Jessie code, yes?