Status: Started Owner: erights Labels: Type-Enhancement Priority-Medium
New issue 1098 by erights: In Cajita, one should be able to initialize static properties of functions using computed names.
http://code.google.com/p/google-caja/issues/detail?id=1098 In Cajita, function foo(){} foo.bar = 8; foo(); // freezes foo, as it should. Creates a function foo, initializes its 'bar' property while it is still unfrozen, and then freezes foo on the first use or escaping occurrence of foo. The initialization of 'bar' translates into a call to ___.setStatic(), which dynamically enforces restrictions specific to properties of functions. All is well so far. However, in function foo(){} foo['bar'] = 8; foo(); the second line is not currently recognized as a static initialization. As a result, foo is frozen at that time causing the initialization to fail. Likewise, the assignment is translated into a ___.setPub(). We just need to add the obvious setIndexStatic rule. There's no safety issue with not knowing the property name statically, since ___.setStatic() already does the needed checking dynamically. The reason it comes up is that the present restrictions prevent Cajita code from creating a membrane-like wrapping function whose properties are derived dynamically by enumerating (and wrapping) properties of the wrapped function. -- You received this message because you are listed in the owner or CC fields of this issue, or because you starred this issue. You may adjust your issue notification preferences at: http://code.google.com/hosting/settings
