| ▲ | rvprasad 4 hours ago | |||||||
While the effort is interesting, I found two issues in the list. First, (.indexOf (seq (byte-array [1 2 3])) 2) fails because byte arrays store bytes and the argument 2 to `.indexOf` is a Long value. Simple type checking (via eyeballing) could have flagged the incorrect usage. I think such exercises can be more helpful if we can reduce the noise. Second, (get "abc" 1.9) fails because `get` coerces the given key to integer in the context of string objects, which makes sense; specifically in the context of weakly typed language. That said, I believe that detailed documentation of the behavior of `get` can help clients just as well as returning `nil` or not-found value. However, we are still left with questions such as "who and where do we draw the line about the dynamism of the language?" and "what is the agreed upon semantics that we are checking against?" | ||||||||
| ▲ | devin 2 hours ago | parent [-] | |||||||
I'm kind of iffy on `(get "abc" 1.9)`. I feel like Clojure has always kind of went out of its way to not go to Ruby levels of implicit dynamism. Think things like: "5" * 3 => "555". Explicit > implicit has been a guiding principle in Clojure since the beginning. For that reason I think the behavior is... a little surprising, but also tend to agree I would stop short of calling it a "bug" in any meaningful sense of the word. I'm curious to see what the core maintainers decide to do about it, if anything. If I were a betting man I'd guess it will stay this way forever because existing programs may quietly (or not-so-quietly) rely on the current behavior. Hyrum's law, anyone? > With a sufficient number of users of an API, it does not matter what you promise in the contract: all observable behaviors of your system will be depended on by somebody. | ||||||||
| ||||||||