lmi
[Top][All Lists]
Advanced

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

Re: [lmi] Raw strings


From: Greg Chicares
Subject: Re: [lmi] Raw strings
Date: Tue, 9 Mar 2021 02:05:06 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.4.0

On 3/9/21 12:25 AM, Vadim Zeitlin wrote:
> 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> 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.

Now committed to 'master'. I'll push it after my next comprehensive test.

>  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.

Either way is fine with me, as long as we standardize on exactly one.
If you want to do the work to switch to 'R"""(', that's fine with me;
if you do, would you please change this line in 'test_coding_rules.cpp':
    static boost::regex const r(R"(\<R"[^(-])");
to permit 'R(' and 'R"""(' only, so that the d-char-sequence must
contain either exactly zero or exactly three double-quotes, which
will guarantee uniformity in future?


reply via email to

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