String reboot (plain text)

Guy Steele guy.steele at oracle.com
Wed Mar 13 18:07:37 UTC 2019


I think that’s right.  I just wanted to point out, for the record, the specific small problem in the one specific example, since no one else had.  That’s all.

I think

        String html = \"""<html>
                            <body style="width: 100vw">
                                  <p>Hello World.</p>
                            </body>
                            <script>console.log("\nloaded")</script>
                          </html>"""\;

looks pretty good.

> On Mar 13, 2019, at 2:23 PM, Brian Goetz <brian.goetz at oracle.com> wrote:
> 
> Jim’s example was a little hard to follow; (I think) he was pulling the string of “what if we just let normal string literals span lines”, and then pulled back from this to say “I think we actually do want a separate delimiter”, and comes to the same conclusion you did. 
> 
>> On Mar 13, 2019, at 1:59 PM, Guy Steele <guy.steele at oracle.com> wrote:
>> 
>> 
>>> On Mar 13, 2019, at 1:52 PM, Brian Goetz <brian.goetz at oracle.com> wrote:
>>> . . .
>>> On 2/10/2019 1:10 PM, Jim Laskey wrote:
>>>> … Let's try symmetry, either \" or "\ as the closing delimiter. "\ is preferable because then it doesn't look like an escape sequence (see Swift.)
>>>> 
>>>>         String html = \"<html>
>>>>                           <body style="width: 100vw">
>>>>                                 <p>Hello World.</p>
>>>>                           </body>
>>>>                           <script>console.log("\nloaded")</script>
>>>>                         </html>"\;
>> I believe there is a small problem with this specific example: doesn’t this string literal end just before the word “loaded” in the penultimate line?  I see a double quote that is (coincidentally) immediately followed by a backslash.
>> 
>> Sorry I failed to note this back in February.
>> 
>> Of course, using \”””…”””\ avoids this problem.
>> 
>> —Guy
>> 
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.java.net/pipermail/amber-spec-experts/attachments/20190313/24d6b797/attachment.html>


More information about the amber-spec-experts mailing list