An unofficial, read-only Hacker News reader. Join the beta →

I checked Clojure's core with Lean and found unreported bugs (opens external site)

238 points by encyclopedism 2 days ago | s.conao3.com | 84 comments on HN

View full thread · View on Hacker News

Comment thread (2)

  1. > Simple type checking (via eyeballing) could have flagged the incorrect usage

    Asking as someone who doesn't know Clojure (or really any lisp): are you saying that this isn't actually a bug, or that the bug could have easily been spotted by a human?

    If the former, that certainly makes the output here somewhat questionable, but if latter, what you're saying basically sounds like it could apply to any runtime type error due to a lack of static type checking that's ever occurred (or really any bug at all); programmers are capable of noticing virtually any bug in theory, but in practice no one is actually able to catch all of them up front. Having a type system is useful because it genuinely does a better job than humans at spotting bugs like this. If you're using a dynamically typed language, there will be errors that human eyeballs could notice but didn't.

    Replies (1)
    1. (.indexOf (seq (byte-array [1 2 3])) 2)

      This is not a bug. This is acting as you would expect once you realize the types you are looking at. While a simple reading of this would expect it to return the "3", this line doesn't return the "3" because the "2" is a Java Long, while the bytes are bytes.