Small problem with multi-line strings
bearophile
bearophileHUGS at lycos.com
Fri Jul 22 03:54:15 PDT 2011
Dmitry Olshansky:
> writeln(
> "- First item: 150\n"
> "- Second item: 200\n"
> "- Third item: 105");
>
> Yeah, I know implicit concatenation is bad and I would agree once ~
> concatenate complie-time string for 0 overhead.
This works, but it's noisy. Multi-line strings are present in D right to avoid this.
> After all, hardcoded strings are not exactly good thing in the first place.
They are frequently needed in little programs, like script-like programs. I expect D to be good enough for such kind of programs too.
> For big formatted texts just use string import :
> writeln(import("usage.txt"));
> work like a charm.
> So IMHO it's a non-issue.
I agree it's not a necessary thing, just like multi-line strings are not necessary. But it's handy, and none of the solutions shown in this tread is very good. So I've added an enhancement request:
http://d.puremagic.com/issues/show_bug.cgi?id=6361
Thank you for the answers and comments,
bye,
bearophile
More information about the Digitalmars-d-learn
mailing list