Skip to content

There's a bug in Slice indexing where it returns a value when there should be an exception #40

@BrucePay

Description

@BrucePay

The following code tests a buggy behaviour when indexing slices. The .Index code will allow you to index 1(?) past the formal length of the slice when there should have been an error. This is easy to fix but it causes a bunch of the internal uses of ^Slice to break. It all needs to be fixed and the slice code needs to be simplified/clarified.

(test/exec :slice36
    (\ ->
        (let s (slice [1 2 3 4] 1 -1))
        [ (!! s 0) (!! s 1) (!! s 2) ]  ; indexing 2 here should throw an exception
    )
    [2 3 4]
)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions