assemblyscript
assemblyscript copied to clipboard
Support private properties syntax
Feature suggestion
Support private properties: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes/Private_properties
Example:
class Class {
#example: i32;
}
Is this just a request to support the # syntax instead of private? Or would you expect a difference in functionality?
Considering the feature overview from the TypeScript 3.8 release notes (when it was added), in TypeScript private is "soft privacy" where # is "hard privacy". But in AssemblyScript, since there's no JS transpile, then I believe private is already "hard privacy".
I do not use private in TypeScript as # supersedes it, so this is useful at least for consistent code style.
I think the only functional difference without JS transpile is #x in y should evaluate to y instanceof this.constructor.