fasterthanlime / shin

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

Expand macros from the outside in #66

Closed fasterthanlime closed 9 years ago

fasterthanlime commented 9 years ago

And not the reverse. Let's take this:

(-> js/window (.' :document) nil? not))

How it should be

If you macro-expand from the outside in, first you get:

(not (nil? (.' js/window :document)))

And then .' can expand correctly (that's the macro from Reagent, by the way)

(not (nil? (aget js/window "document")))

And everything is fine with the world.

How it currently be

However, if you expand from the inside out, first you get:

Meep meep: that's not a valid `.'` invocation - we're missing the object.

Wanna know what's cool though? It's easy to fix!