Message from JavaScript discussions

June 2017

— As I understood it, you could access #props only from within the class definition itself


class Foo {
#privateValue = 42;
static getPrivateValue(foo)
return foo.#privateValue;

Foo.getPrivateValue(new Foo()); // >> 42

— From this

— Accessing private properties using static methods scares me. I don't think you could have pretend private properties that were capable of that without introducing a real class system.

Message permanent page

— It took me awhile to see what was going on there. Very weird behavior and definitely not something people are looking for.

Message permanent page

— Wait, wat

— You can access private props from static methods??

— It lets any instance of foo reference private members of any other instance of foo, yes

— Uuuuuuuuhhhh

— Ugly

— I ASSUMED only instance methods would be able to access the prop (only of self of course)

— Wait... this shouldn't be a problem though