You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Aseem Bansal (JIRA)" <ji...@apache.org> on 2015/10/10 20:41:05 UTC

[jira] [Created] (GROOVY-7625) Slashy string in groovy allows brackets but double quoted string does not. Why?

Aseem Bansal created GROOVY-7625:
------------------------------------

             Summary: Slashy string in groovy allows brackets but double quoted string does not. Why?
                 Key: GROOVY-7625
                 URL: https://issues.apache.org/jira/browse/GROOVY-7625
             Project: Groovy
          Issue Type: Documentation
            Reporter: Aseem Bansal
            Priority: Minor


This

    println("$()")

gives me a compiler error "Either escape a dollar sign or bracket the value expression"

But this 

    println(/$()/)

prints `$()` fine. No errors

Why is there a difference? The only documented difference is that slashy strings make working with backslashes easier. I understand that a variable name cannot start with a bracket so it should be possible to make that special case. Is that the case for the slashy strings?

Just came across this when doing something with regex.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)