[webkit-dev] JSC Suggestion: Class property locking

Oliver Hunt oliver at apple.com
Tue Aug 18 12:28:25 PDT 2009


EcmaScript 5 defines a number of functions (freeze, seal,  
preventExtensions) that basically do this -- we just haven't yet  
implemented these.

But you can provide custom get and put functions which you could just  
make throw on unrecognised property names.

--Oliver

On Aug 18, 2009, at 12:21 PM, Brian Barnes wrote:

> Another quick suggestion, and this is obviously just another  
> convenience method (I'm sure I could handle this by overriding):   
> It'd be nice to be able to lock a class (it could be a flag on the  
> definition) to make adding properties (outside the static variable  
> and function list) illegal.
>
> For instance, I have a problem with my users misspelling a property,  
> then not understanding why nothing happens.  In this case, they'd  
> get an error.
>
> Basically, if you can't find a setter in my static lists, then toss  
> an error.
>
> [>] Brian
> _______________________________________________
> webkit-dev mailing list
> webkit-dev at lists.webkit.org
> http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev



More information about the webkit-dev mailing list