Re: Better string constants
Carl Gay <[email protected]>
| Newsgroups | gmane.comp.lang.dylan.gwydion.devel |
|---|---|
| Message-ID | <CALekcH0kRZ-Ejk+FcSzA0YHGdY+-ehZoZBu2rYXGZXCsw9yO5w@mail.gmail.com> |
Just to summarize, I think it's fair to say that everyone so far is in favor of (or at least is not against) """ to delimit multi-line "interpreted" strings but there's not much support for raw string syntax in the language. I'll experiment with r-parser and possibly regex-parser, built on that, and will (at some point in my copious free time) either implement """ and/or write a DEP for it. On Wed, Feb 27, 2013 at 9:55 PM, Carl Gay <[email protected]> wrote: > I really want better string constant syntax in Dylan. Doing this sort of > thing... > > parse-coil("A: {\n" > " a: 'a'\n" > " b: 'b'\n" > " c: 'c'\n" > "}\n" > ... > or > "\"5\"" > > is really tedious and error prone. (Both of the above are from a test > suite.) > > We need two things: > (1) raw string literals > (2) multi-line strings > > Briefly, my suggestions are: > * Use """ for multiline backslash-interpreted strings. > * Use ` (backquote) for one-line raw strings. > * Use ``` for multi-line raw strings. > > `"5"` == "\"5\"" > `\d+\.` == "\\d+\\." > ```A: { > a: 'a' > b: 'b' > c: 'c' > }``` == the string near the top of this message. > > While I think it may be possible to use `...` for multi-line raw strings > (as Go does) it bothers me that there's no way to embed a backquote, and > also I like having the symmetry of "..." / """...""" and `...` / ```...```. > > Another possibility I like is #r"..." and #r"""...""" for raw strings. > > Thoughts/opinions? > > _______________________________________________ hackers mailing list [email protected] https://lists.opendylan.org/mailman/listinfo/hackers