[
https://issues.apache.org/jira/browse/TINKERPOP3-673?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14570425#comment-14570425
]
Michael Pollmeier commented on TINKERPOP3-673:
----------------------------------------------
If I understand this correctly you're moving all typing to the runtime, i.e. if
the traversal happens to return a single element the return type is Element,
otherwise it's List<Element>. Is that the right understanding? That means that
the return type has to be Object for each traversal? I can list a few
downsides, but first I'd like to make sure I'm reading this correctly.
> limit(local, 1) should emit element, not List
> ---------------------------------------------
>
> Key: TINKERPOP3-673
> URL: https://issues.apache.org/jira/browse/TINKERPOP3-673
> Project: TinkerPop 3
> Issue Type: Improvement
> Components: process
> Reporter: Matt Frantz
>
> The philosophy of the TP3 API is "containers only when necessary". There is
> a tendency to eschew the container when its size would be one.
> For example, {{select("foo")}} will not emit a {{Map}} with a single
> key/value, but instead will emit a single value. Similarly, if any
> {{select}} of a step label finds only a single instance of that step in the
> path, it will emit the value at that step; only if multiple steps in the path
> have the same label will a {{List}} be created.
> In that spirit, {{limit(local, 1)}} should emit an element, rather than a
> one-element {{List}}.
> This would also mean that {{range(local)}} operating on a {{List}} would emit
> a single element if the number of elements is selected by the range is 1.
> This would also reconcile the behavior with the {{tail}} step.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)