ClojureScript

binding breaks in macros

Details

  • Type: Defect Defect
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Duplicate
  • Affects Version/s: None
  • Fix Version/s: None
  • Component/s: None
  • Labels:
  • Environment:
    unimportant

Description

When creating a macro that results in a binding the name of the global bound variables resolves into namespace bound names - this breaks the assert in clojurescripts let code.

example (simplified):
(ns clgl.macros)
(defmacro with-gl [[gl prog] & body]
`(binding [*gl* ~gl *prog* ~brog] ~@body))

(ns clgl.core
(:require-macros [clgl.macros :as m]))
...
(with-gl [gl prog]
(do-something))

Activity

Hide
David Nolen added a comment -

I'm not sure I follow. What does gl and prog get namespaced to?

Show
David Nolen added a comment - I'm not sure I follow. What does gl and prog get namespaced to?
Hide
Jozef Wagner added a comment -

I think he has a problem with

*gl*
resolving into
clgl.macros/*gl*
when expanding macro, and this produces error in clojurescript (no such ns exists in cljs).

Solution is to use

~'*gl*
instead of
*gl*
inside macro.

So IMO this issue is not a CLJS defect and should be closed.

Show
Jozef Wagner added a comment - I think he has a problem with
*gl*
resolving into
clgl.macros/*gl*
when expanding macro, and this produces error in clojurescript (no such ns exists in cljs). Solution is to use
~'*gl*
instead of
*gl*
inside macro. So IMO this issue is not a CLJS defect and should be closed.

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: