<story><title>V8 release v7.2</title><url>https://v8.dev/blog/v8-release-72</url></story><parent_chain><item><author>drinchev</author><text>&amp;gt; V8 v7.2 adds support for public class [1] fields. Support for private class [2] fields is planned for a future V8 release.&lt;p&gt;For those who don&amp;#x27;t know private class fields add the weird &amp;quot;#&amp;quot; character for defining them inside the `class {}` block.&lt;p&gt;&lt;pre&gt;&lt;code&gt;    class IncreasingCounter {
       #count = 0;
       get value() {
           console.log(&amp;#x27;Getting the current value!&amp;#x27;);
           return this.#count;
       }
       increment() {
           this.#count++;
       }
    }
&lt;/code&gt;&lt;/pre&gt;
This looks way worse than having what TypeScript did by introducing `public` &amp;#x2F; `private` keywords. Is there any body
which votes for es-next features such as this one? I wonder how the &amp;quot;#&amp;quot; private field popped up in Chrome specs.&lt;p&gt;1 : &lt;a href=&quot;https:&amp;#x2F;&amp;#x2F;developers.google.com&amp;#x2F;web&amp;#x2F;updates&amp;#x2F;2018&amp;#x2F;12&amp;#x2F;class-fields&quot; rel=&quot;nofollow&quot;&gt;https:&amp;#x2F;&amp;#x2F;developers.google.com&amp;#x2F;web&amp;#x2F;updates&amp;#x2F;2018&amp;#x2F;12&amp;#x2F;class-fiel...&lt;/a&gt;&lt;p&gt;2 : &lt;a href=&quot;https:&amp;#x2F;&amp;#x2F;developers.google.com&amp;#x2F;web&amp;#x2F;updates&amp;#x2F;2018&amp;#x2F;12&amp;#x2F;class-fields#private_class_fields&quot; rel=&quot;nofollow&quot;&gt;https:&amp;#x2F;&amp;#x2F;developers.google.com&amp;#x2F;web&amp;#x2F;updates&amp;#x2F;2018&amp;#x2F;12&amp;#x2F;class-fiel...&lt;/a&gt;</text></item></parent_chain><comment><author>gardaani</author><text>If you think that the # syntax for private fields needs to be improved, then go to JS Committee&amp;#x27;s GitHub Issues and give feedback about it:&lt;p&gt;&lt;a href=&quot;https:&amp;#x2F;&amp;#x2F;github.com&amp;#x2F;tc39&amp;#x2F;proposal-class-fields&amp;#x2F;issues&quot; rel=&quot;nofollow&quot;&gt;https:&amp;#x2F;&amp;#x2F;github.com&amp;#x2F;tc39&amp;#x2F;proposal-class-fields&amp;#x2F;issues&lt;/a&gt;&lt;p&gt;There&amp;#x27;s at least three specifically about the #:&lt;p&gt;&lt;a href=&quot;https:&amp;#x2F;&amp;#x2F;github.com&amp;#x2F;tc39&amp;#x2F;proposal-class-fields&amp;#x2F;issues&amp;#x2F;177&quot; rel=&quot;nofollow&quot;&gt;https:&amp;#x2F;&amp;#x2F;github.com&amp;#x2F;tc39&amp;#x2F;proposal-class-fields&amp;#x2F;issues&amp;#x2F;177&lt;/a&gt;&lt;p&gt;&lt;a href=&quot;https:&amp;#x2F;&amp;#x2F;github.com&amp;#x2F;tc39&amp;#x2F;proposal-class-fields&amp;#x2F;issues&amp;#x2F;149&quot; rel=&quot;nofollow&quot;&gt;https:&amp;#x2F;&amp;#x2F;github.com&amp;#x2F;tc39&amp;#x2F;proposal-class-fields&amp;#x2F;issues&amp;#x2F;149&lt;/a&gt;&lt;p&gt;&lt;a href=&quot;https:&amp;#x2F;&amp;#x2F;github.com&amp;#x2F;tc39&amp;#x2F;proposal-class-fields&amp;#x2F;issues&amp;#x2F;142&quot; rel=&quot;nofollow&quot;&gt;https:&amp;#x2F;&amp;#x2F;github.com&amp;#x2F;tc39&amp;#x2F;proposal-class-fields&amp;#x2F;issues&amp;#x2F;142&lt;/a&gt;&lt;p&gt;Remember to be constructive or just give a thumbs up to comments you like.</text></comment>
<story><title>V8 release v7.2</title><url>https://v8.dev/blog/v8-release-72</url></story><parent_chain><item><author>drinchev</author><text>&amp;gt; V8 v7.2 adds support for public class [1] fields. Support for private class [2] fields is planned for a future V8 release.&lt;p&gt;For those who don&amp;#x27;t know private class fields add the weird &amp;quot;#&amp;quot; character for defining them inside the `class {}` block.&lt;p&gt;&lt;pre&gt;&lt;code&gt;    class IncreasingCounter {
       #count = 0;
       get value() {
           console.log(&amp;#x27;Getting the current value!&amp;#x27;);
           return this.#count;
       }
       increment() {
           this.#count++;
       }
    }
&lt;/code&gt;&lt;/pre&gt;
This looks way worse than having what TypeScript did by introducing `public` &amp;#x2F; `private` keywords. Is there any body
which votes for es-next features such as this one? I wonder how the &amp;quot;#&amp;quot; private field popped up in Chrome specs.&lt;p&gt;1 : &lt;a href=&quot;https:&amp;#x2F;&amp;#x2F;developers.google.com&amp;#x2F;web&amp;#x2F;updates&amp;#x2F;2018&amp;#x2F;12&amp;#x2F;class-fields&quot; rel=&quot;nofollow&quot;&gt;https:&amp;#x2F;&amp;#x2F;developers.google.com&amp;#x2F;web&amp;#x2F;updates&amp;#x2F;2018&amp;#x2F;12&amp;#x2F;class-fiel...&lt;/a&gt;&lt;p&gt;2 : &lt;a href=&quot;https:&amp;#x2F;&amp;#x2F;developers.google.com&amp;#x2F;web&amp;#x2F;updates&amp;#x2F;2018&amp;#x2F;12&amp;#x2F;class-fields#private_class_fields&quot; rel=&quot;nofollow&quot;&gt;https:&amp;#x2F;&amp;#x2F;developers.google.com&amp;#x2F;web&amp;#x2F;updates&amp;#x2F;2018&amp;#x2F;12&amp;#x2F;class-fiel...&lt;/a&gt;</text></item></parent_chain><comment><author>__ryan__</author><text>The rationale for the &amp;quot;#&amp;quot; syntax is that it makes it clear that the field is NOT an object property. This is an important distinction because you can do this:&lt;p&gt;&lt;pre&gt;&lt;code&gt;  class Example {
      #myVar = 100;

      getPrivateMyVar() {
          return this.#myVar;
      }

      getLocalMyVar() {
          return this.myVar();
      }
  }

  const example = new Example();

  example.myVar = 200;

  console.log(example.getPrivateMyVar()) &amp;#x2F;&amp;#x2F; 100;
  console.log(example.getLocalMyVar()) &amp;#x2F;&amp;#x2F; 200;
&lt;/code&gt;&lt;/pre&gt;
I agree the syntax is terrible. But you need to be able to distinguish between the own object property &lt;i&gt;myVar&lt;/i&gt; and the private field &lt;i&gt;myVar&lt;/i&gt;.</text></comment>