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

ASF GitHub Bot commented on TINKERPOP-2280:
-------------------------------------------

spmallette commented on pull request #1181: TINKERPOP-2280 Changed toString of T
URL: https://github.com/apache/tinkerpop/pull/1181
 
 
   https://issues.apache.org/jira/browse/TINKERPOP-2280
   
   Reduce confusion when `T` is in a `Map` and users overload property keys 
that match `T` instance names like "label" and "id". I think I'm still 
classifying this as a non-breaking change despite changing the form of the 
`toString()`. Folks probably shouldn't be relying on that in their code. I 
would think they would simply use `name()` as you typically would with an 
`enum` if you were working with the string representation. 
   
   All tests pass with `docker/build.sh -t -n -i`
   
   VOTE +1
 
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


> Make toString() of T less susceptible to confusion with property overloads
> --------------------------------------------------------------------------
>
>                 Key: TINKERPOP-2280
>                 URL: https://issues.apache.org/jira/browse/TINKERPOP-2280
>             Project: TinkerPop
>          Issue Type: Improvement
>          Components: structure
>    Affects Versions: 3.3.8
>            Reporter: stephen mallette
>            Assignee: stephen mallette
>            Priority: Major
>
> It's not a great practice but we often see folks overloading "label" and "id" 
> as property keys on elements. The problem here is that `valueMap()` will tend 
> to end up looking like this:
> {code}
> gremlin> g.V().has('label').valueMap(true)
> ==>[id:13,label:[thing],label:person]
> {code}
> The {{toString()}} representation is confusing as you can't really tell 
> what's an {{T}} instance in the keys and what is not. If we alter 
> {{toString()}} to include the {{T}} we get:
> {code}
> gremlin> g.V().has('label').valueMap(true)
> ==>[T.id:13,label:[thing],T.label:person]
> {code}
> It's not as pretty as before (assuming no overloading) but at least we 
> eliminate confusions folks used to have with this. I don't think this is a 
> breaking change really because most folks won't be operating on the 
> {{toString()}} value of a {{Map}}. They will be accessing this {{Map}} with a 
> {{T}} instance.



--
This message was sent by Atlassian JIRA
(v7.6.14#76016)

Reply via email to