Message from JavaScript discussions
June 2017
— I thought the whole point was non-accessible props
Eh, I muddled over Symbols for awhile myself. Many people come up with varying use cases which all have varying validity.
— In the end, all a Symbol is, is an unknowable value. What use that is, is up to interpretation
— It is basically a UUID no one can directly observe, but can still get a reference to if it is assigned to an object
— More just out of the way of casual observation
— It is non enumerable, which can be useful
— Another thing you could do with the function syntax that you CAN'T do with class syntax is to 'redirect' the caller to use new if they omitted it:
function MyClass() {
if (!(this instanceof MyClass)) {
return new MyClass();
}
// ...
}
class syntax doesn't give you this at all
— Will return an object that is always instanceof MyClass
— Pretty awesome
— Wow
— That is sick!!
— A few builtins use this