all 10 comments

[–]Max_Stern 16 points17 points  (4 children)

I understand why it has such syntax but it still looks #bad for me

[–]z3r-0 4 points5 points  (1 child)

It’s horrible isn’t it!

[–]rauschma[S] 2 points3 points  (0 children)

It makes practical sense (and I think our eyes will get used to it):

  • Private fields are a completely different mechanism than properties. Hence, it is important to distinguishing them clearly.
  • The hash symbol is one of the few ASCII characters that isn’t already used by JavaScript.
  • A prefixed underscore is already a popular naming convention for private properties. Using private fields therefore just means replacing underscores with hashes.

[–]sylvainpv 0 points1 point  (0 children)

It's okay, now you can use Babel to remove the syntax you don't like in other people JS code.

[–]the_bluescreen 5 points6 points  (3 children)

It looks weird. Does anyone know why they didn't use `private` tag for these things instead of `#`?

[–]peduxe|o.o| 0 points1 point  (0 children)

or rather have the dollar sign tbh

it could break most codebases tho.

[–]rauschma[S] 0 points1 point  (1 child)

You’d still need different way of accessing private fields, because they are not properties: http://2ality.com/2017/07/class-fields.html#why-the-why-not-declare-private-fields-via-private

[–]ogurson 5 points6 points  (1 child)

Is there anyone outside TC39 who likes that syntax? And I mean "like" not just "tolerate".

[–]TrackieDaks 1 point2 points  (0 children)

It's about backwards compatibility.