Re: Better string constants
Bruce Mitchener <[email protected]>
| Newsgroups | gmane.comp.lang.dylan.gwydion.devel |
|---|---|
| Message-ID | <CA+esKjN78nmX3jFQZBWP15bRV=q_7d0w1iDkLU42OycpR6Ry=Q@mail.gmail.com> |
I'm +1 on """ ... """ But I'm +10 on being able to improve your life today. :) - Bruce On Thu, Feb 28, 2013 at 7:47 PM, Carl Gay <[email protected]> wrote: > okay, that's fine with me as long as r-parser goes in common-dylan. We > still need """ though. > > > On Wed, Feb 27, 2013 at 10:58 PM, Bruce Mitchener < > [email protected]> wrote: > >> It isn't a proposal that needs implementing. It works right now in every >> release since Open Dylan was open sourced. Go try it. >> >> - Bruce >> >> >> >> On Thu, Feb 28, 2013 at 10:54 AM, Carl Gay <[email protected]> wrote: >> >>> Even if we implemented your proposal for parsers, I still think we need >>> better string literals. At least """, but we could conceivably implement >>> #r as parse-r. :-) >>> >>> >>> On Wed, Feb 27, 2013 at 10:00 PM, Bruce Mitchener < >>> [email protected]> wrote: >>> >>>> define constant coil-parser = parse-coil; >>>> >>>> let c = #coil:[ >>>> >>>> A: { >>>> a: 'a' >>>> b: 'b' >>>> c: 'c' >>>> } >>>> ]; >>>> >>>> Suspect that works right now in OpenDylan 2012.1. >>>> >>>> - Bruce >>>> >>>> >>>> >>>> On Thu, Feb 28, 2013 at 9:55 AM, 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 >>>>> >>>>> >>>> >>>> _______________________________________________ >>>> hackers mailing list >>>> [email protected] >>>> https://lists.opendylan.org/mailman/listinfo/hackers >>>> >>>> >>> >>> _______________________________________________ >>> hackers mailing list >>> [email protected] >>> https://lists.opendylan.org/mailman/listinfo/hackers >>> >>> >> >> _______________________________________________ >> hackers mailing list >> [email protected] >> https://lists.opendylan.org/mailman/listinfo/hackers >> >> > > _______________________________________________ > hackers mailing list > [email protected] > https://lists.opendylan.org/mailman/listinfo/hackers > > _______________________________________________ hackers mailing list [email protected] https://lists.opendylan.org/mailman/listinfo/hackers