fasterthanlime / shin

:warning: (def shin (dissoc clojurescript :jvm :google_closure)) (deprecated)
MIT License
35 stars 1 forks source link

Problem with let? #95

Open fasterthanlime opened 9 years ago

fasterthanlime commented 9 years ago

cljs.core's impl of get-in is shadowing-heavy. The code looks like:

(defn get-in
  ([m ks]
     (get-in m ks nil))
  ([m ks not-found]
     (loop [sentinel lookup-sentinel
            m m
            ks (seq ks)]
       (if ks
         (if (not (satisfies? ILookup m))
           not-found
           (let [m (get m (first ks) sentinel)]
             (if (identical? sentinel m)
               not-found
               (recur sentinel m (next ks)))))
         m))))

It seems m is shadowed too many times for Shin :) and it produces unexpected code (haven't really looked at it yet).

Changing the loop's second binding to prev exhibits correct behavior, so I'm going to go with that for now, but I wanted to keep track of the issue so we can squash it later.