-
-
Notifications
You must be signed in to change notification settings - Fork 224
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
ES2022: prototypeを表すのに # を使うべきかどうか #1368
Comments
https://zenn.dev/qnighy/articles/3a999fdecc3e81#comment-aaac501b3562a4 |
要検証ではあるけど、次のようなイメージ
|
これに賛成です。 毎回 "Arrayインスタンスの" と書くのは冗長すぎるかなと。 |
https://jsprimer.net/use-case/todoapp/
|
#1382 で変更をまとめてした |
ES2022のクラスに
#
が導入される。なので
#
はPrivate Fieldsを意味するように見える。MyClass#method
と書いてしまうと、MyClass.prototype.method
とMyClass
のprivate#method
のことかが区別できなくなる。(📝 実際にはthis.#method
としてアクセスするので、.#
となるけど、表現的に紛らわしいのは同じ)そのため、
Array#includes
みたいに prototypeを表す記号として#
を使うのは、避けたほうがいい可能性が高い。変更後の基本ルール
Array.prototype.includes
メソッド 」を使うincludes
メソッド」を使うArray.from
静的メソッド 」と言うことで区別するa
プロパティ」という表現Class Fieldはまだ未定メンバー
と呼ぶ感じで、プロパティと区別div#result
はlintのオプションで例外としてるやるべきこと
#
を prototype に置き換える#
がprototypeを表す記号として使われていることがあったと言うコラムをたす#
===prototype
は取り除くけど、他の文章でも使われてること多い@lacolaco どうですかね?
The text was updated successfully, but these errors were encountered: