You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Paul King (JIRA)" <ji...@apache.org> on 2015/09/01 14:55:45 UTC

[jira] [Comment Edited] (GROOVY-7564) InvokerHelper verbose printing wrongly escapes backslashes

    [ https://issues.apache.org/jira/browse/GROOVY-7564?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14725342#comment-14725342 ] 

Paul King edited comment on GROOVY-7564 at 9/1/15 12:55 PM:
------------------------------------------------------------

I agree there is a bug with inspect but I guess I am saying I disagree with you about format ... but only a little bit. And please take my comments as simply a means to impart my incomplete knowledge of the history of some of the methods you are proposing to change. Here is what I believe the situation is:
* I think we have a good handle of Groovy's default representation for objects
* I think we have a good handle of what Groovy's inspect method does (even though we don't claim it works perfectly for all objects)
* We also have a verbose flag on some of the format methods within InvokerHelper the behavior of which we haven't clearly defined

We happen to use the verbose flag for inspect but other users of Groovy might also use that method and not expect the "inspect" behavior; they just don't want some of the minimalization which you get with Groovy's default representation. As it turns out, I don't think we can justify having three different formatting options, so I am keen to push our APIs towards just two variants which is where your PR is heading. I am just noting that we should be treading carefully. I am not too concerned since we are talking about methods which most users of Groovy won't be calling directly but if Spock or GPars or Grails are making direct calls, we might cause some unintended indirect pain.
So, I wouldn't be against your change so long as we mark it as a breaking change, release note it as such and ensure all of the appropriate methods become clearly documented in the process. But even better, I'd prefer most of the methods to be moved into a FormatHelper class which would let us leave some old behaviors in place if we want - unchanged but deprecated.


was (Author: paulk):
I agree there is a bug with inspect but I guess I am saying I disagree with you about format ... but only a little bit. And please take my comments as simply a means to impart my incomplete knowledge of the history of some of the methods you are proposing to change. Here is what I believe the situation is:
* I think we have a good handle of Groovy's default representation for objects
* I think we have a good handle of what Groovy's inspect method does (even though we don't claim it works perfectly for all objects)
* We also have a verbose flag on some of the format methods within InvokerHelper the behavior of which we haven't clearly defined
We happen to use the verbose flag for inspect but other users of Groovy might also use that method and not expect the "inspect" behavior; they just don't want some of the minimalization which you get with Groovy's default representation. As it turns out, I don't think we can justify having three different formatting options, so I am keen to push our APIs towards just two variants which is where your PR is heading. I am just noting that we should be treading carefully. I am not too concerned since we are talking about methods which most users of Groovy won't be calling directly but if Spock or GPars or Grails are making direct calls, we might cause some unintended indirect pain.
So, I wouldn't be against your change so long as we mark it as a breaking change, release note it as such and ensure all of the appropriate methods become clearly documented in the process. But even better, I'd prefer most of the methods to be moved into a FormatHelper class which would let us leave some old behaviors in place if we want - unchanged but deprecated.

> InvokerHelper verbose printing wrongly escapes backslashes 
> -----------------------------------------------------------
>
>                 Key: GROOVY-7564
>                 URL: https://issues.apache.org/jira/browse/GROOVY-7564
>             Project: Groovy
>          Issue Type: Bug
>            Reporter: Thibault Kruse
>            Priority: Minor
>
> Tor reproduce:
> {code}
> groovy:000> InvokerHelper.format('a\\b', true, -1)
> ===> 'a\b'
> {code}
> Should be 
> {code}'a\\b'{code}
> See https://github.com/apache/incubator-groovy/pull/96



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