String Interpolation

H. S. Teoh hsteoh at qfbox.info
Fri Oct 27 20:11:18 UTC 2023


On Fri, Oct 27, 2023 at 07:18:08PM +0000, djent via Digitalmars-d wrote:
> Much like the entrepreneur, the language designer is tasked with the
> difficult job of predicting what users would want in contrast with
> what they currently have and expect. This is how innovation
> materializes.
> 
> After giving Adam's implementation a spin, I'm convinced this is the
> proper way to move forward despite not having conceived it as a
> possibility beforehand. It's powerful, exploiting D's superior
> metaprogramming and DBI capabilities, but doesn't stray too far from
> the current situation found in many languages in that one can just use
> `text` or something similar if a plain string is required.
> 
> I anticipate the worst solution will win out given Walter's
> disposition, but I nonetheless hope for the best.

I also hope that Adam's approach will win.  To me, it's the design that
best leverages the existing strengths of D: metaprogramming, DbI, and
strikes a pretty good balance between power and convenience.  This gives
it the potential address many of the issues that were brought up against
string interpolation -- having it integrate well into DbI means you
actually have a fighting chance of mitigating such issues without adding
yet another hack into the compiler/language.

Walter's solution in contrast seems rather lackluster, it solves only
one specific case but leaves other use cases out in the cold, and we
eventually end up with yet another half-baked feature that works well
enough on its own but doesn't really integrate deeply with the rest of
the language.


T

-- 
Knowledge is that area of ignorance that we arrange and classify. -- Ambrose Bierce


More information about the Digitalmars-d mailing list