lmi
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lmi] Raw strings


From: Vadim Zeitlin
Subject: Re: [lmi] Raw strings
Date: Tue, 9 Mar 2021 01:25:57 +0100

On Mon, 8 Mar 2021 22:11:29 +0000 Greg Chicares <gchicares@sbcglobal.net> wrote:

GC> Can we devise an lmi rule for handling raw literals uniformly?

 I'd be glad to!

GC> Thus, my proposal is:
GC> 
GC> std::string const simple_table_values = 
GC> 1 + R"--8<--8<--8<--(
GC>   0  0.12345
GC>   1  0.23456
GC> )--8<--8<--8<--";
GC> 
GC> or, even better IMO:
GC> 
GC> std::string const simple_table_values = 
GC> 1 + R"--cut-here--(
GC>   0  0.12345
GC>   1  0.23456
GC> )--cut-here--";
GC> 
GC> Exception: one-line definitions can use an empty d-char-sequence.

 I can live with this but why do we need to make the delimiter sequence so
long? If you like Java text blocks, which use the same delimiters as Python
raw strings, why not do the same thing and write

---------------------------------- >8 --------------------------------------
std::string const simple_table_header =
1 + R"""(
Table number: 1
Table type: Aggregate
Minimum age: 0
Maximum age: 1
Number of decimal places: 5
Table values:
)""";
---------------------------------- >8 --------------------------------------

? This seems quite readable to me and it's short and memorable enough to
use it without having to look it up every time.

GC> Now I feel like Mr. Rosewater in that book.

[I didn't read this one, so I don't know if it's good or bad]

VZ

Attachment: pgpLUuhFPxmkZ.pgp
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]