Feedback on Átila's Vision for D

Meta jared771 at gmail.com
Tue Oct 15 16:38:44 UTC 2019


On Tuesday, 15 October 2019 at 16:22:22 UTC, Atila Neves wrote:
> I suggest using `std.conv.text` instead. For one liners it's 
> (IMHO) nearly the same as string interpolation. I think string 
> interpolation only comes into its own with multi-line strings, 
> which is common in D because of string mixins and q{}.
>
>> pragma(msg) get's this right, presumably because it's a 
>> compile time-only construct.
>
> std.conv.text works exactly the same way.

I know, and I do like std.conv.text, but you can't put it in 
trailing/UFCS position with multiple arguments:

//doesn't work
in (a < b, ("argument must be greater than argument b (a: ", a, 
", b: ", b, ")").text())

And it causes me great pain to write `text("a message ", with " 
lots of ", interleaved, " ", arguments)`

Which is why I prefer to use format (not to mention the comma 
soup making the string much more busy visually with text()).

With interpolated strings, presumably this could be allowed?

i"argument must be greater than argument b (a: $a, b: $b)".text()

Which I could live with, but would still prefer it if even the 
text() could be omitted.


More information about the Digitalmars-d mailing list