You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jan 25, 2022. It is now read-only.
The following should work, and it would mean that we can provide much better functionality:
classFoo{
# x=5test(){console.log(this.# x)// it should work, but it doesn't}}
It didn't work in Chrome (I am doubting it is a bug in Chrome, and that is it working as spec'd, which throws a syntax error).
Looks like the #foo is treated as a name, which is what makes things like indexed-access not currently possible (or so it seems).
If we change the semantics so that .# is an operator (f.e. it means "access a private property, of which the name follows"), and can be separated by spaces just like with public access using ., then we can accommodate other features like indexed access in a way that makes sense:
constpropName='bar'classFoo{foo=3
# foo=4[# propName]=5test(){console.log(this.foo)// it works, 3console.log(this.# foo)// it should work, 4console.log(this[#'foo'])// it should work, 4console.log(this[# 'foo'])// it should work, 4console.log(this.# bar)// it should work, 5console.log(this[# propName])// it should work, 5}}
because now the syntax is tied to the type of access you want to attempt, not tied to the name of the field.