3 ms·
I think 'lockdown' type things can be really helpful when debugging code. Being able to lock something down, and be 100% sure that it can never be changed, by s
by axod 17y ago
I think 'lockdown' type things can be really helpful when debugging code. Being able to lock something down, and be 100% sure that it can never be changed, by some weird eval(), by any 3rd party libs you're using, other developers code etc is very helpful.
You could also use it to find where a property is being accessed from - just set it to writable:false - then see where an exception is thrown from.
Also enforcing access - maybe you have a setTitle() function you want to be used instead of directly accessing the .title property. Now you can enforce that.
Just as in Java, the keywords private and protected are a good mechanism for controlling access.
These updates look really cool. Well thought out.
- mshafrir 17y agoLockdown would be like the final keyword in Java.