On Fri, Dec 16, 2011 at 7:42 AM, Axel Rauschmayer <[email protected]> wrote:
> I'll just re-state this paragraph to illustrate that the glass is half > empty: > > Unlike classes, object exemplars are just objects. There is no language > support for detecting a object exemplar; developers have no help in > avoiding pernicious debilitating bugs caused by data values in base > classes. > > > “There is no language support for detecting a object exemplar” – via > static analysis? Yes, tricky, one could infer object exemplars by looking > at the operands of "new". > (I believe that 'language support' effectively mean single-file static analysis, not whole program analysis implied by your trick). > > Would you say that either of these problems exist with class declarations > that have object exemplar semantics? > => Easier to detect via static analysis. > => Can forbid non-method properties in prototypes. > > Sorry I don't understand the question, or how it is related to my quest. I'll answer two I think are related: Is there a static-analysis test that can be applied to an object literal to determine if it is suitable as an object exemplar? Yes, forbid non-method properties. Is there a reasonable mechanism to go beyond a non-method-property restriction on object exemplars? Yes, use those fancy Object.defineProperty thingys to allow the 1% cases where you want non-method exemplar props. jjb
_______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

