noprompt / meander

Tools for transparent data transformation
MIT License
918 stars 55 forks source link

Do not compile unnecessary dissoc expressions #191

Closed noprompt closed 3 years ago

noprompt commented 3 years ago

This expression

(m/match {:a 1}  {:a ?x} ?x))

generates the following code.

(let*
  [R__26396
   (let*
     [T__26393 {:a 1}]
     (let*
       [T__26394 (. T__26393 valAt :a)]
       (let*
         [?x T__26394]
         (let* [T__26395 (dissoc T__26393 :a)] ?x))))]
  (if (meander.match.runtime.epsilon/fail? R__26396)
    (throw (ex-info "non exhaustive pattern match" {}))
    R__26396))

Note the unnecessary (dissoc T_26393 :a).