Skip to content

range's output should include its second argument #582

Open
@hallpell

Description

@hallpell

Currently, range() follows the conventions of other languages, where range(0,5) returns [0,1,2,3,4]. This makes sense mainly because range(0,array.length) is such a common use case of range in other languages.

However, we don't do very much indexing of arrays in Woof (pretty sure it never shows up in documentation), which makes me less certain that we need to follow this standard for range(). I think it makes more sense to say range(1,5) will count from 1 to 5, and thus return [1,2,3,4,5].

I'm unsure if we actually want this change due to backwards compatibility concerns (it will make most uses of range() in existing projects have one more thing inside them, which will break some things), but is worth considering.

The actual code to change this is trivially easy, making < into <= on 1805 and doing the same for the decreasing for loop at 1811

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions