<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body>
    <br>
    <blockquote type="cite" cite="mid:AS8PR10MB779835602F2476BF425979B4D302A@AS8PR10MB7798.EURPRD10.PROD.OUTLOOK.COM">
      <div class="WordSection1"><span lang="EN-GB"><o:p></o:p></span><span lang="EN-GB"><o:p> </o:p></span>
        <p class="MsoNormal"><span lang="EN-GB">This does not mean I
            think having side effects to string interpolation is a good
            idea, and it also doesn’t mean that you can’t get this same
            safety with side effect free interpolation. If the logger’s
            log methods have an overload for a `Templated` object that
            would be returned by the `LOG.”...”` interpolation, one
            could just not template expand any `Strings` passed to the
            logger.<o:p></o:p></span></p>
        <p class="MsoNormal"><span lang="EN-GB">Having
            `logger.info(LOG.”value: \{value}”)` is a bit more unwieldly
            to some than just `LOG.”value: \{value}”`, so I think it’s
            gonna be inevitable that people are gonna add sideeffects
            somewhere to interpolations.<o:p></o:p></span></p>
        <br>
      </div>
    </blockquote>
    <br>
    I think you've laid it out here: you acknowledge that having
    LOG."stuff" *do* the logging is a bad idea, when there's an entirely
    sensible alternative that gets you the desired safety and deferral
    of expensive formatting:<br>
    <br>
        logger.info(LOGMSG."...")<br>
    <br>
    This is a responsible API design that meets the goals of its use
    case.  The real problem, as you've put it, is programmers that put
    concision above clarity:<br>
    <br>
    <blockquote type="cite"><span lang="EN-GB">Having
        `logger.info(LOG.”value: \{value}”)` is a bit more unwieldly to
        some than just `LOG.”value: \{value}”`, </span></blockquote>
    <br>
    Yes, bad programmers will say "the right way is a bit more unwieldy,
    so of course I will do it the other way".  Bad programmers will
    design bad APIs and misuse good ones all in the name of saving a few
    characters (or a few cycles when it doesn't matter.)  Let's just
    call it what it is, and try to set a better example.<br>
    <br>
    <br>
    <div class="moz-cite-prefix">On 7/24/2023 8:26 AM, <a class="moz-txt-link-abbreviated" href="mailto:forax@univ-mlv.fr">forax@univ-mlv.fr</a>
      wrote:<br>
    </div>
    <blockquote type="cite" cite="mid:1158621703.2630607.1690201588943.JavaMail.zimbra@univ-eiffel.fr">
      <div><br>
      </div>
      <div>The problem of <span lang="EN-GB">logger.info(LOG.”value:
          \{value}”)</span> is that the logger receive a string, not a
        string template</div>
    </blockquote>
    <br>
    No, not necessarily.  LOG can be a (purely functional)
    TemplateProcessor<LogMsg>, which defers rendering the string
    until it is actually logged:<br>
    <br>
        logger.info(LogMsg msg)<br>
    <br>
    Then you have a free choice over where to put the validation (in
    LOG, or in the logger.)  <br>
    <br>
    <br>
    <br>
  </body>
</html>