This release includes new optional
warnings (:invalid-aget
and :invalid-aset
) that indicate,
when known via type inference, that aget
or aset
is
operating on non-arrays or being supplied non-numeric indices.
These warnings can be enabled
in order to highlight instances of a common pattern where these
APIs are used for object property access—as in (aget #js {:foo 1} "foo")
.
While this works, it is only an unintended aspect of the
current implementation. Usages of aget
or aset
on objects should be corrected
to instead use the facilities in the goog.object
namespace,
such as goog.object/get
or goog.object/set
.
Doing this enables the core implementations of aget
and
aset
to evolve while focusing on array access.