ajvincent / es-membrane

An ECMAScript implementation of a Membrane, allowing users to dynamically hide, override, or extend objects in JavaScript with controlled effects on the original objects.
ISC License
109 stars 13 forks source link

Standard distortion type: Enforce argument checking via WebIDL #188

Open ajvincent opened 5 years ago

ajvincent commented 5 years ago

Suppose we have a set of WebIDL definitions and a way to map them to constructors. Then we can do several checks:

ajvincent commented 5 years ago

This has to account for objects implementing multiple interfaces.

ajvincent commented 5 years ago

Note: argument checking may be impractical if the argument is from a different object graph than the function to call, and if the WebIDL is complex (a, a.b, and a.b.c must all meet different interfaces, for example).