-
Notifications
You must be signed in to change notification settings - Fork 5.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adopt ECMAScript Private Fields #3980
Comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
We should adopt ECMAScript private fields in the internal code within Deno and in
std
. We have a couple of different patterns in the code base in regards to this (TypeScriptprivate
and using WeakMaps in Events) and should adopt a consistent mechanism which provides us with the runtime privacy of data. We have a 3rd pattern where we have marked some fields as private, but they are defined with a symbol to make it easy to utilise an interator interface. We might reconsider dropping theprivate
keyword.Private fields do not apply to methods (fields are not part of prototype, while methods are), so not all of our use of the
private
keyword could be easily addressed (I am not too personally keen on turning methods into fields, as having them part of the prototype is far more efficient).TypeScript 3.8 will support ECMAScript private fields, V8 already supports them. But, right now prettier and dprint do not. We still use prettier for formatting our internal code, and dprint for
deno fmt
.Refs #3937
Refs prettier/prettier#7263
Refs dsherret/dprint#91
The text was updated successfully, but these errors were encountered: