Not sure if anyone has proposed that before. I would suggest this syntax rather than the terrible # prefix in case we really need private in JavaScript.
class SomeClass {
private { // private keyword defines a companion object for SomeClass
myPrivateField: 5;
myPrivateFunc() {
}
}
myPublicFunc() {
private.myPrivateFunc(); // private is a special operator too to access the private companion object
return private.myPrivateField;
}
}
Not sure if anyone has proposed that before. I would suggest this syntax rather than the terrible # prefix in case we really need private in JavaScript.