<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix">For me optional seems very misleading
      and generally different prefixes suggests that those objects are
      not the same.<br>
      Maybe IfExists does not sound nicely but at least it's clear. I
      would choose to have a pointer version with IfExists and a
      reference version which is a noun, like:<br>
      <br>
      StyleResolver* styleResolverIfExists()<br>
      StyleResolver&amp; styleResolver()<br>
      <br>
      Br,<br>
      -Balazs<br>
      <br>
      <br>
      On 06/19/2013 10:28 AM, Maciej Stachowiak wrote:<br>
    </div>
    <blockquote
      cite="mid:B02DC63A-A474-4429-9AE1-19BF88FDA29B@apple.com"
      type="cite">
      <meta http-equiv="content-type" content="text/html;
        charset=ISO-8859-1">
      <div><br>
      </div>
      <div>On Jun 18, 2013, at 10:16 PM, Ryosuke Niwa &lt;<a
          moz-do-not-send="true" href="mailto:rniwa@webkit.org">rniwa@webkit.org</a>&gt;
        wrote:<br>
        <br>
      </div>
      <blockquote type="cite">
        <div>
          <div dir="ltr">On Tue, Jun 18, 2013 at 7:20 PM, Simon Fraser <span
              dir="ltr">&lt;<a moz-do-not-send="true"
                href="mailto:simon.fraser@apple.com" target="_blank">simon.fraser@apple.com</a>&gt;</span>
            wrote:<br>
            <div class="gmail_extra">
              <div class="gmail_quote">
                <blockquote class="gmail_quote" style="margin:0px 0px
                  0px
0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
                  <div style="word-wrap:break-word">
                    <div>
                      <div class="h5">On Jun 18, 2013, at 7:11 PM, Darin
                        Adler &lt;<a moz-do-not-send="true"
                          href="mailto:darin@apple.com" target="_blank">darin@apple.com</a>&gt;
                        wrote:<br>
                        <div><br>
                          <blockquote type="cite">
                            <div
style="letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">On
                              Jun 18, 2013, at 7:05 PM, Ryosuke Niwa
                              &lt;<a moz-do-not-send="true"
                                href="mailto:rniwa@webkit.org"
                                target="_blank">rniwa@webkit.org</a>&gt;
                              wrote:<br>
                              <br>
                              <blockquote type="cite">Why don't we call
                                it requireStyleResolver() instead?<br>
                              </blockquote>
                              <br>
                              I&#8217;m warming to this idea. Maybe we can use
                              &#8220;require&#8221; as a term of art, analogous to
                              the way we use &#8220;create&#8221;, to mean &#8220;create
                              if not already created&#8221;.<br>
                            </div>
                          </blockquote>
                        </div>
                        <br>
                      </div>
                    </div>
                    <div>Since the fact that it returns a reference
                      implies that it must create something if
                      necessary, the &#8220;required&#8221; part of the name seems
                      redundant. Why not just</div>
                    <div><span style="white-space:pre-wrap"> </span>StyleResolver&amp;
                      styleResolver()</div>
                    <div><br>
                    </div>
                    <div>requireStyleResolver() sounds like it would
                      return a bool.</div>
                  </div>
                </blockquote>
                <div><br>
                </div>
                <div style="">True. But it's important to differentiate
                  a simple inline accessor and a lazily-create function
                  because it's very easy to write code like:</div>
                <div style=""><br>
                </div>
                <div style="">if (styleResolver().x())<br>
                </div>
                <div style="">&nbsp; &nbsp; styleResolver().y();<br>
                </div>
                <div style=""><br>
                </div>
                <div style="">and incur two function calls when we could
                  have done</div>
                <div style=""><br>
                </div>
                <div style="">StyleResolver&amp; resolver =
                  styleResolver();</div>
                <div style="">
                  <div>if (resolver.x())<br>
                  </div>
                  <div>&nbsp; &nbsp; resolver.y();</div>
                  <div><br>
                  </div>
                  <div style="">instead.</div>
                  <div style=""><br>
                  </div>
                  <div style="">On the other hand, I've started to think
                    that maybe we can simply forbid the former style
                    altogether in the style guide so that we'll never
                    have to think about whether a given function is
                    inline or not.</div>
                </div>
              </div>
            </div>
          </div>
        </div>
      </blockquote>
      <div><br>
      </div>
      <div><span style="-webkit-tap-highlight-color: rgba(26, 26, 26,
          0.296875); -webkit-composition-fill-color: rgba(175, 192, 227,
          0.230469); -webkit-composition-frame-color: rgba(77, 128, 180,
          0.230469); ">I don't think possible lazy creation is a good
          reason to decorate the name. Functions should be named for
          what they do, not their presumed efficiency.</span></div>
      <div><span style="-webkit-tap-highlight-color: rgba(26, 26, 26,
          0.296875); -webkit-composition-fill-color: rgba(175, 192, 227,
          0.230469); -webkit-composition-frame-color: rgba(77, 128, 180,
          0.230469); "><br>
        </span></div>
      <div><span style="-webkit-tap-highlight-color: rgba(26, 26, 26,
          0.296875); -webkit-composition-fill-color: rgba(175, 192, 227,
          0.230469); -webkit-composition-frame-color: rgba(77, 128, 180,
          0.230469); ">I am also not sure we need a style guideline
          about putting things into variables. If it makes a difference
          in a hot code path, then sure, but most of the time, the more
          concise code is better.</span></div>
      <div><span style="-webkit-tap-highlight-color: rgba(26, 26, 26,
          0.296875); -webkit-composition-fill-color: rgba(175, 192, 227,
          0.230469); -webkit-composition-frame-color: rgba(77, 128, 180,
          0.230469); "><br>
        </span></div>
      <div><span style="-webkit-tap-highlight-color: rgba(26, 26, 26,
          0.296875); -webkit-composition-fill-color: rgba(175, 192, 227,
          0.230469); -webkit-composition-frame-color: rgba(77, 128, 180,
          0.230469); ">&nbsp;- Maciej</span></div>
      <br>
      <blockquote type="cite">
        <div>
          <div dir="ltr">
            <div class="gmail_extra">
              <div class="gmail_quote">
                <div style="">
                  <div style=""><br>
                  </div>
                </div>
                <div style="">- R. Niwa</div>
                <div style=""><br>
                </div>
              </div>
            </div>
          </div>
        </div>
      </blockquote>
      <blockquote type="cite">
        <div><span>_______________________________________________</span><br>
          <span>webkit-dev mailing list</span><br>
          <span><a moz-do-not-send="true"
              href="mailto:webkit-dev@lists.webkit.org">webkit-dev@lists.webkit.org</a></span><br>
          <span><a moz-do-not-send="true"
              href="https://lists.webkit.org/mailman/listinfo/webkit-dev">https://lists.webkit.org/mailman/listinfo/webkit-dev</a></span><br>
        </div>
      </blockquote>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
webkit-dev mailing list
<a class="moz-txt-link-abbreviated" href="mailto:webkit-dev@lists.webkit.org">webkit-dev@lists.webkit.org</a>
<a class="moz-txt-link-freetext" href="https://lists.webkit.org/mailman/listinfo/webkit-dev">https://lists.webkit.org/mailman/listinfo/webkit-dev</a>
</pre>
    </blockquote>
    <br>
  </body>
</html>