groovy-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul King <>
Subject Re: About refining regex literal syntax
Date Tue, 23 Oct 2018 03:33:16 GMT
It would be nice to simplify Strings especially in light of Raw String
literals being added to Java which I suspect we will want to support at
some stage. The thing is that slashy and dollar slashy strings aren't the
same in various ways not just line endings. Changing them to be more the
same (so that they could be considered the single and multi-line versions
of one another) would be quite a large change. Obviously Groovy 3.0 is a
time to consider larger changes than normal.

However, having just one example isn't enough for me to properly evaluate
the merits of a potential change.
I believe a full blown GEP would be required. E.g. would the proposed
change alter the meaning of the following:

m /c/ d

Which can mean any of:


Another example, slashy strings are special in that they can appear in only
certain places in the grammar, so you can't have:

println /foo/

or any empty slashy string (it's a comment):

def x = //
assert x.size() == 3

And these are just a few of dozens of cases we should look at if really
trying to simplify string handling. We'd ideally include raw strings too.
Some of the cases for slashy string won't change since removing the
newlines won't change the underlying circumstances causing these
restrictions but we'd need to check if any do or allow us to make further
improvements if we wanted to. We would also need to cover migration tools
in the GEP since we'd be breaking lots of existing code potentially.

Cheers, Paul.

On Tue, Oct 23, 2018 at 11:02 AM Daniel Sun <> wrote:

> Hi  Guillaume,
>         Groovy has multiline version for regex already, i.e. `$/.../$`, so
> `/.../` also supporting is redundant IMHO ;-)
>         Similarly, `"..."` and `'...'` have their multline versions, i.e.
> `'''...'''` and `"""..."""`, so they just support single line.
>         P.S. `"..."` and `'...'` support multiline in Parrot, it is
> actually
> a bug and fixed last week.
> Cheers,
> Daniel.Sun
> --
> Sent from:

View raw message