String Interpolation

Jonathan M Davis newsgroup.d at jmdavisprog.com
Thu Oct 26 02:02:49 UTC 2023


On Wednesday, October 25, 2023 7:47:33 PM MDT Adam D Ruppe via Digitalmars-d 
wrote:
> On Thursday, 26 October 2023 at 00:24:33 UTC, Walter Bright wrote:
> > The money shot:
> >
> > "The design of template expressions deliberately makes it
> > impossible to go directly from a string literal or text block
> > with embedded expressions to a String with the expressions'
> > values interpolated. This prevents dangerously incorrect
> > strings from spreading through a program."
>
> Yup. Even if we went with an object in D instead of a tuple, I'd
> be against the `alias toString this;` part. Just too much history
> saying that's a bad idea for D to embrace it at this point.

Implicit conversions are fraught with dangers in general. Sometimes, they're
really useful to have, but they're often problematic, and they're even more
problematic in generic code. So, they should be used with care, and IMHO, we
should default to avoiding them rather than adding them.

- Jonathan M Davis





More information about the Digitalmars-d mailing list