[Docs] Clarify the behvior of first, last, and nth on empty generators
I was confused by this behavior so thought it might be good to document it.
Maybe you want to update the docs for last/1 but editing the wrong place. jq "[range(.)] | [[first], [last], [nth(5)]]" <<< "0" yields [[null],[null],[null]].
@itchyny I moved the doc update to the correct section
My understanding is that PR currently adds the text:
`last` returns `null` instead.
Of course, that is true of the current implementation, but if this behavior is to be documented in the manual, there should be a disclaimer to the effect that the behavior may change in the future.
(As @itchyny recently pointed out:
See https://github.com/jqlang/jq/pull/1869. This is a bug that should be fixed in the future. )
first/0 having the same behavior as .[0] seems logical to me.
The existence of first/last/nth seems a bit pointless anyways since you can just use .[0], .[-1], .[n] which are shorter. But that's an entirely seperate point.
I submitted a patch for the issue: #3179.