News for hackers. Stuff that matters.
Re:Symbols in ECMAScript 6 by STRML on Monday December 29, 2014 @09:48AM (#8809953)
Reflect.ownKeys will list all keys (string or symbol or otherwise) of an object. It's not clear from the article if it can be excluded via an ES5 definition with `enumerable: false`; perhaps so? In that case, this is pretty cool.
Re:Symbols in ECMAScript 6 by chriswarbo on Monday December 29, 2014 @09:58AM (#8810004)
I'm not sure of the JS implementation in particular, but it wouldn't surprise me. Keep in mind that the security/encapsulation features of many languages (private, final, const, etc.) can be bypassed using reflection, especially in "more dynamic" languages like Javascript.
Re:Symbols in ECMAScript 6 by Arnavion on Monday December 29, 2014 @08:14PM (#8812799)
There's also Object.getOwnPropertySymbols()

At any rate, Symbol properties aren't meant to be a bullet-proof way to hide private properties. They just reduce the default public API surface of an object by suppressing its internals.