I don't recall the design decision behind this at all, but from this perspective it looks weird and then Daniel brings up that link of insanity (not an easy thread) and without thinking too much into history of why this is like this I gotta wonder if irrespective of history, this should change to be more consistent. I assume the unwrapping for limit(local,1) was done out of convenience to downstream steps as the typical pattern would be to pop off the first object out of a list and then use it in the stream
g.inject([1, 2, 3], [4]).limit(local, 1).sum()
Without that we would have to do:
g.inject([1, 2, 3], [4]).limit(local, 1).unfold().sum()
Not the worst thing, but I suppose the current interpretation from the Gremlin perspective is that limit(local, 1) means I want one object from the list and therefore it's not a List I want anymore, it's the single object inside the list. Perhaps that is too much magic. I might be in favor of changing this behavior to be more consistent, thus: