<html>
    <head>
      <base href="https://bugs.webkit.org/" />
    </head>
    <body>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - [INTL] Implement Intl.NumberFormat.prototype.resolvedOptions ()"
   href="https://bugs.webkit.org/show_bug.cgi?id=147602#c11">Comment # 11</a>
              on <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - [INTL] Implement Intl.NumberFormat.prototype.resolvedOptions ()"
   href="https://bugs.webkit.org/show_bug.cgi?id=147602">bug 147602</a>
              from <span class="vcard"><a class="email" href="mailto:sukolsak&#64;gmail.com" title="Sukolsak Sakshuwong &lt;sukolsak&#64;gmail.com&gt;"> <span class="fn">Sukolsak Sakshuwong</span></a>
</span></b>
        <pre>Thanks for the review

(In reply to <a href="show_bug.cgi?id=147602#c10">comment #10</a>)
<span class="quote">&gt; &gt; Source/JavaScriptCore/runtime/IntlNumberFormat.h:87
&gt; &gt; +    unsigned m_minimumIntegerDigits;
&gt; &gt; +    unsigned m_minimumFractionDigits;
&gt; &gt; +    unsigned m_maximumFractionDigits;
&gt; 
&gt; These need initializers.
&gt; 
&gt; &gt; Source/JavaScriptCore/runtime/IntlNumberFormat.h:91
&gt; &gt; +    bool m_useGrouping;
&gt; 
&gt; And this.</span >

The only functions that read these attributes are Intl.NumberFormat.prototype.resolvedOptions and (in the upcoming patch) Intl.NumberFormat.prototype.format. They always check that the NumberFormat object has been initialized. If not, they initialize it. These attributes are always set in the initialization. So, I think it's fine to not have initializers for these. What do you think?

Related question: The only time resolvedOptions() is called, but the NumberFormat object has not been initialized, is when we call &quot;Intl.NumberFormat.prototype.resolvedOptions()&quot;. The spec says that &quot;The Intl.NumberFormat prototype object is itself an Intl.NumberFormat instance ... whose internal slots are set as if it had been constructed by the expression Construct(%NumberFormat%).&quot; But I don't want to populate the internal slots of the prototype eagerly, because Intl.NumberFormat.prototype is created when JSGlobalObject is created. Is it fine to do lazy initialization like this?

<span class="quote">&gt; &gt; Source/JavaScriptCore/runtime/IntlNumberFormatConstructor.cpp:73
&gt; &gt; +    Vector&lt;String&gt; keyLocaleData({
&gt; 
&gt; Can we use std::array here instead? We don't intend to grow or shrink this
&gt; data structure.</span >

The localeData() function is passed to the resolveLocale() function, which expects a function pointer of type Vector&lt;String&gt; (*localeData)(const String&amp;, const String&amp;). I can't change the return type to std::array because vectors of different size are also passed to it.

<span class="quote">&gt; &gt; Source/JavaScriptCore/runtime/IntlNumberFormatPrototype.cpp:156
&gt; &gt; +    options-&gt;putDirect(vm, Identifier::fromString(&amp;vm, &quot;minimumIntegerDigits&quot;), jsNumber(nf-&gt;minimumIntegerDigits()));
&gt; &gt; +    options-&gt;putDirect(vm, Identifier::fromString(&amp;vm, &quot;minimumFractionDigits&quot;), jsNumber(nf-&gt;minimumFractionDigits()));
&gt; &gt; +    options-&gt;putDirect(vm, Identifier::fromString(&amp;vm, &quot;maximumFractionDigits&quot;), jsNumber(nf-&gt;maximumFractionDigits()));
&gt; &gt; +    if (nf-&gt;minimumSignificantDigits())
&gt; &gt; +        options-&gt;putDirect(vm, Identifier::fromString(&amp;vm, &quot;minimumSignificantDigits&quot;), jsNumber(nf-&gt;minimumSignificantDigits()));
&gt; &gt; +    if (nf-&gt;maximumSignificantDigits())
&gt; &gt; +        options-&gt;putDirect(vm, Identifier::fromString(&amp;vm, &quot;maximumSignificantDigits&quot;), jsNumber(nf-&gt;maximumSignificantDigits()));
&gt; &gt; +    options-&gt;putDirect(vm, Identifier::fromString(&amp;vm, &quot;useGrouping&quot;), jsBoolean(nf-&gt;useGrouping()));
&gt; 
&gt; I think we want these to be CommonIdentifiers so we don't have to keep
&gt; allocating and hashing them.</span >

There are only two places that use these identifiers: the constructor and prototype.resolvedOptions(), which probably won't be called very often. Should I still add these to CommonIdentifiers?</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>