• Walnut356@programming.devOP
    link
    fedilink
    English
    arrow-up
    1
    ·
    1 year ago

    it makes what looks like formatting an arbitrary complex operation and that it doesn’t improve readability that much.

    What’s silly to me about that reasoning is that all workarounds are equally less convenient, have less readability, and the effect is identical to just letting me put whatever between the brackets. I genuinely dont understand the downside i guess.

    Calling .join on a vector can have side effects too, except the “we’re concatting strings” is at the end rather than the beginning (and could obfuscate the fact that the end result is a string). It has just as much room for abuse as a long format!(). Even with just format!(), anything you could do inbetween the brackets, you can do outside the brackets in the arguments anyway. At least when it’s between the brackets, i know exactly where it’s going and when without having to juggle the string pieces and assemble them in my head.

    • lad@programming.dev
      link
      fedilink
      English
      arrow-up
      3
      ·
      1 year ago

      Well, that’s all true from an end user perspective. But consider that format! is a macro and as such it should process its format string. Calling something from inside evaluation of a format string really does seem weird in that regard