Any interest in raw strings?
Stephen Colebourne
scolebourne at joda.org
Wed Mar 25 03:41:59 PDT 2009
Personally, I would say that raw strings (prefixed by r, not
multiline) were a good candidate for a Coin. The change would seem
relatively small, and they compile to a standard String instance.
I wouldn't especially like to see RegExp strings, as it ties the
compiler too closely to one specific library.
Stephen
2009/3/25 Reinier Zwitserloot <reinier at zwitserloot.com>:
> Because raw strings are only used for regexps (it's so bad that people
> think the 'r' in python's raw string syntax stands for regexp and not
> raw), I suggested a while ago, on a different forum, to support regexp
> literals, which would even get the benefit of compile-time checking
> the regexp (there are a few things which are neccessarily a bad reg-
> exp, such as mismatched parentheses), and possibly the compile-time
> generation of the regexp literal to a regexp Thompson's tree, which
> takes relatively long to build, but once built, can parse any string
> through the regexp in O(n), where n is the length of the string.
>
> Back then there were some admittedly rare use-cases for raw strings
> (including concatenating a regexp with a variable, which you couldn't
> do with regexp literals), but there was no consensus on whether raw
> strings, or regexp literals (or possibly both) were a good idea.
>
> I'd love me some raw (and multiline) strings, but this stuff is a bit
> too tricky to sort out now, a month or two before java7RC1.
>
> --Reinier Zwitserloot
>
>
>
> On Mar 25, 2009, at 00:58, Vilya Harvey wrote:
>
>> Ah, I had a feeling I might have missed something. It looks like
>> you've
>> already covered everything I wanted to write up and more! I think
>> multiline
>> strings would be a useful addition too; it seems a shame that it
>> won't be
>> included in the Coin changes.
>>
>> Cheers,
>> Vil.
>>
>>
>> 2009/3/24 <rssh at gradsoft.com.ua>
>>
>>>> Hi all,
>>>>
>>>> I don't think I've seen a proposal for raw strings - string literals
>>> which
>>>> ignore escape sequences - yet. Would there be enough interest to
>>>> write
>>>> this
>>>> up as a proposal?
>>>>
>>>> The idea is stolen shamelessly from Python, where you can write a
>>>> raw
>>>> string
>>>> as r"[\n\r\t]" and it's equivalent to the normal string "[\\n\\r\
>>>> \t]"
>>>> (i.e.
>>>> you don't need to double the backslash in a raw string, it's just
>>>> treated
>>>> like any other character). This is most useful when writing regular
>>>> expressions; in fact, it may *only* be useful then. But for that
>>>> one case
>>>> it
>>>> is extremely handy.
>>>>
>>>> Any opinions?
>>>>
>>>
>>> It was part of my enhanched string proposal
>>> http://redmine.gradsoft.ua/wiki/java7stringliterals
>>>
>>> If creating new proposal only for unescaped strings (without
>>> multiline)
>>> can help (ask Darcy) -- than submit one. It woud be better than
>>> nothing.
>>>
>>>> Vil.
>>>>
>>>>
>>>
>>>
>>>
>>
>
>
>
More information about the coin-dev
mailing list