aget produces different results from Clojure for non-integer and out-of-bounds indexes

Description

Like CLJS-2113, but for aget:

Clojure:

ClojureScript

Also note that Clojure acts as if rounding indices down to the nearest integer while ClojureScript does not:

yields 1 in Clojure and nil in ClojureScript.

(Presumably, similar results hold for aset.)

Environment

None

Activity

Show:
Mike Fikes
November 18, 2017, 4:02 PM

The fact that Clojure's aget happens to work on non-integer indices may not be intentional. An int cast may be present only to ease interop with the default use of long integral values in Clojure, and while this cast causes the observed behavior (rounding down of passed double s), this may not reflect the intended API.

Here is a commit that speaks to "hints": https://github.com/clojure/clojure/commit/742619e583400400e69cd46ab9e9536c10afb738

Assignee

Unassigned

Reporter

Mike Fikes

Labels

None

Approval

None

Patch

None

Affects versions

Priority

Major