endo icon indicating copy to clipboard operation
endo copied to clipboard

Consider adding function/method guards

Open gibson042 opened this issue 3 years ago • 2 comments

As observed in https://github.com/endojs/endo/pull/1282#discussion_r970038535 and https://github.com/endojs/endo/pull/1282#discussion_r970074074 , there is a need to construct wrappers that make assertions about and/or mutate output from another function. It can be done manually like fn = (baseFn => arg => { const result = baseFn(arg); typeof result === 'string' && result.startsWith('#') || assert.fail(…); return harden(result); })(fn), but we might also consider generalizing and pulling in "patterns" functionality from @agoric/store.

gibson042 avatar Sep 23 '22 03:09 gibson042

@gibson042 , this would now be about exos for far functions, yes?

erights avatar Mar 04 '24 18:03 erights

Possibly, although it seems better to keep argument/return shape checking independent of exportability.

gibson042 avatar Mar 18 '24 03:03 gibson042