<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body>
    <font size="4"><font face="monospace">Yes, I would frame this one as
        a "lucky near miss", where there's a removable discontinuity in
        Rational that permits it to work with a small amount of extra
        effort.  The author will likely do the appropriate input
        checking (and possibly GCD reduction) in the explicit ctor, but
        the key is that because of the implicit ctor, the author has to
        do some additional checking elsewhere too.  <br>
        <br>
        Because it can all be factored through a `denom` accessor *in
        this case*, it is not very intrusive, but I am not positioning
        this as a general property, as much as "we got lucky with
        Rational and might get lucky with other similar cases that are
        at the boundary."  <br>
        <br>
        I think much of the value of the Rational example is not
        "building a better Rational", as much as a cookbook example of
        something that _almost_ fits the implicitly-constructible mold,
        and a how-to guide for how to deal with this flavor of
        "almost."  If we had a few others, we'd have a cookbook cooking,
        and that would be a good thing.<br>
        <br>
      </font></font><br>
    <div class="moz-cite-prefix">On 6/1/2023 1:46 PM, Kevin Bourrillion
      wrote:<br>
    </div>
    <blockquote type="cite" cite="mid:CAGKkBks514NfiwoBKy2uNMzCp3ZszLe-j+SexB8rdAbaoW6Pgw@mail.gmail.com">
      
      <div dir="ltr">
        <div dir="ltr">On Thu, Jun 1, 2023 at 10:35 AM Brian Goetz <<a href="mailto:brian.goetz@oracle.com" moz-do-not-send="true" class="moz-txt-link-freetext">brian.goetz@oracle.com</a>>
          wrote:<br>
        </div>
        <div dir="ltr"><br>
        </div>
        <div class="gmail_quote">
          <blockquote class="gmail_quote" style="margin:0px 0px 0px
            0.8ex;border-left:1px solid
            rgb(204,204,204);padding-left:1ex">
            <div><font size="4"><font face="monospace">Rational is
                  unfortunate because the default representation (when
                  used improperly) can lead to DBZE, but has a sensible
                  default of zero -- except for that pesky denominator. 
                  However, I think this is a removable discontinuity,
                  where the author can make up for this with some
                  careful coding:<br>
                </font></font></div>
          </blockquote>
          <div><br>
          </div>
          <div>It helps a bit that you want to canonicalize all 0/n to <i>something</i> anyway,
            and rational operations are already busy taking the gcd and
            ensuring positive denominator as it is. The need to
            internally represent zero as 0/0 probably adds little
            incremental pain in *this* case, but there will be others
            where it does. Still, overall it seems like a very fine
            trade-off.</div>
          <div><br>
          </div>
          <div><br>
          </div>
        </div>
        <span class="gmail_signature_prefix">-- </span><br>
        <div dir="ltr" class="gmail_signature">
          <div dir="ltr">
            <div>
              <div dir="ltr">
                <div>
                  <div dir="ltr">
                    <div style="line-height:1.5em;padding-top:10px;margin-top:10px;color:rgb(85,85,85);font-family:sans-serif"><span style="border-width:2px 0px
0px;border-style:solid;border-color:rgb(213,15,37);padding-top:2px;margin-top:2px">Kevin
                        Bourrillion |</span><span style="border-width:2px 0px
0px;border-style:solid;border-color:rgb(51,105,232);padding-top:2px;margin-top:2px"> Java/Kotlin
                        Ecosystem Team |</span><span style="border-width:2px 0px
0px;border-style:solid;border-color:rgb(0,153,57);padding-top:2px;margin-top:2px"> Google,
                        Inc. |</span><span style="border-width:2px 0px
0px;border-style:solid;border-color:rgb(238,178,17);padding-top:2px;margin-top:2px"> <a href="mailto:kevinb@google.com" target="_blank" moz-do-not-send="true" class="moz-txt-link-freetext">kevinb@google.com</a></span></div>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </blockquote>
    <br>
  </body>
</html>