Skip to content

docs: clarify that seq returns a string, not an integer slice#479

Open
c-tonneslan wants to merge 1 commit into
Masterminds:masterfrom
c-tonneslan:docs/clarify-seq-return-type
Open

docs: clarify that seq returns a string, not an integer slice#479
c-tonneslan wants to merge 1 commit into
Masterminds:masterfrom
c-tonneslan:docs/clarify-seq-return-type

Conversation

@c-tonneslan
Copy link
Copy Markdown

Closes #465.

seq lives on the "Integer Slice Functions" docs page next to until and untilStep, but it returns a space-separated string instead of a []int. The page never says that, so the natural reading is "all three of these return slices" and people try to range over the result. That's what filed the bug.

Just adds a short paragraph after the ## seq heading noting the return type and pointing at until / untilStep for an actual slice. No code change, the bash-like behavior is intentional.

The seq function is documented on integer_slice.md alongside until and
untilStep, but unlike those two it returns a space-separated string,
not a slice. The wording made it sound like another slice-returning
helper, so anyone trying to range over the result hits a type error
and ends up filing it as a bug (issue Masterminds#465).

Note up front what seq actually returns and point readers at until /
untilStep if they want a slice they can iterate.

Closes Masterminds#465

Signed-off-by: Charlie Tonneslan <cst0520@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

seq function returns string instead of integer slice

1 participant