How to use the :use form in clojurescript

124 views
Skip to first unread message

Murtaza Husain

unread,
Jun 3, 2012, 3:20:13 PM6/3/12
to clo...@googlegroups.com
Hi,

I am using enfocus where the macros can be used in this manner (from enfocus's site)-

(ns my.namespace
(:require [enfocus.core :as ef])
(:require-macros [enfocus.macros :as em]))

(defn start []
(em/at js/document
[“body”] (em/content “Hello world!”))

However I would like to directly use the "at" and "content" macros. In clojure this can be done by importing the namespaces using the :use form. Can I do the same in clojurescript?

Thanks,
Murtaza

Michał Marczyk

unread,
Jun 3, 2012, 10:16:40 PM6/3/12
to clo...@googlegroups.com
(:use-macros [enfocus.macros :only [at content]])

Note :use(-macros) is only supported with :only in ClojureScript.

Cheers,
Michał
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clo...@googlegroups.com
> Note that posts from new members are moderated - please be patient with your
> first post.
> To unsubscribe from this group, send email to
> clojure+u...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en

Murtaza Husain

unread,
Jun 3, 2012, 11:32:51 PM6/3/12
to clo...@googlegroups.com

Michal thanks for the help.

This is the error that lein-cljsbuild gives me when using :only -

java.lang.AssertionError: Assert failed: Only (:require [lib.ns :as alias]*) form of :require / :require-macros is supported
(and expr (= :as kw))



On Monday, June 4, 2012 7:46:40 AM UTC+5:30, Michał Marczyk wrote:
(:use-macros [enfocus.macros :only [at content]])

Note :use(-macros) is only supported with :only in ClojureScript.

Cheers,
Michał


On 3 June 2012 21:20, Murtaza Husain <murtaza.husain@sevenolives.com> wrote:
> Hi,
>
> I am using enfocus where the macros can be used in this manner (from
> enfocus's site)-
>
> (ns my.namespace
>
>   (:require [enfocus.core :as ef])
>
>   (:require-macros [enfocus.macros :as em]))
>
> (defn start []
>
>   (em/at js/document
>
>     [“body”] (em/content “Hello world!”))
>
> However I would like to directly use the "at" and "content" macros. In
> clojure this can be done by importing the namespaces using the :use form.
> Can I do the same in clojurescript?
>
> Thanks,
> Murtaza
>
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clo...@googlegroups.com
> Note that posts from new members are moderated - please be patient with your
> first post.
> To unsubscribe from this group, send email to
> clojure+unsubscribe@googlegroups.com

Michał Marczyk

unread,
Jun 4, 2012, 12:07:35 AM6/4/12
to clo...@googlegroups.com
Then I expect you typed

(:require-macros [lib.ns :only [...]])

You need to use

(:use-macros [lib.ns :only [...]])

instead.


On 4 June 2012 05:32, Murtaza Husain <murtaza...@sevenolives.com> wrote:
>
> Michal thanks for the help.
>
> This is the error that lein-cljsbuild gives me when using :only -
>
> java.lang.AssertionError: Assert failed: Only (:require [lib.ns :as alias]*)
> form of :require / :require-macros is supported
> (and expr (= :as kw))
>
>
>
> On Monday, June 4, 2012 7:46:40 AM UTC+5:30, Michał Marczyk wrote:
>>
>> (:use-macros [enfocus.macros :only [at content]])
>>
>> Note :use(-macros) is only supported with :only in ClojureScript.
>>
>> Cheers,
>> Michał
>>
>>
>> On 3 June 2012 21:20, Murtaza Husain <murtaza...@sevenolives.com>
>> wrote:
>> > Hi,
>> >
>> > I am using enfocus where the macros can be used in this manner (from
>> > enfocus's site)-
>> >
>> > (ns my.namespace
>> >
>> >   (:require [enfocus.core :as ef])
>> >
>> >   (:require-macros [enfocus.macros :as em]))
>> >
>> > (defn start []
>> >
>> >   (em/at js/document
>> >
>> >     [“body”] (em/content “Hello world!”))
>> >
>> > However I would like to directly use the "at" and "content" macros. In
>> > clojure this can be done by importing the namespaces using the :use
>> > form.
>> > Can I do the same in clojurescript?
>> >
>> > Thanks,
>> > Murtaza
>> >
>> > --
>> > You received this message because you are subscribed to the Google
>> > Groups "Clojure" group.
>> > To post to this group, send email to clo...@googlegroups.com
>> > Note that posts from new members are moderated - please be patient with
>> > your
>> > first post.
>> > To unsubscribe from this group, send email to
>> > clojure+u...@googlegroups.com
>> > For more options, visit this group at
>> > http://groups.google.com/group/clojure?hl=en
>
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clo...@googlegroups.com
> Note that posts from new members are moderated - please be patient with your
> first post.
> To unsubscribe from this group, send email to
> clojure+u...@googlegroups.com

Murtaza Husain

unread,
Jun 4, 2012, 1:20:29 AM6/4/12
to clo...@googlegroups.com

Thanks for catching that Michal :)



On Monday, June 4, 2012 9:37:35 AM UTC+5:30, Michał Marczyk wrote:
Then I expect you typed

  (:require-macros [lib.ns :only [...]])

You need to use

  (:use-macros [lib.ns :only [...]])

instead.


On 4 June 2012 05:32, Murtaza Husain <murtaza.husain@sevenolives.com> wrote:
>
> Michal thanks for the help.
>
> This is the error that lein-cljsbuild gives me when using :only -
>
> java.lang.AssertionError: Assert failed: Only (:require [lib.ns :as alias]*)
> form of :require / :require-macros is supported
> (and expr (= :as kw))
>
>
>
> On Monday, June 4, 2012 7:46:40 AM UTC+5:30, Michał Marczyk wrote:
>>
>> (:use-macros [enfocus.macros :only [at content]])
>>
>> Note :use(-macros) is only supported with :only in ClojureScript.
>>
>> Cheers,
>> Michał
>>
>>
>> On 3 June 2012 21:20, Murtaza Husain <murtaza.husain@sevenolives.com>
>> wrote:
>> > Hi,
>> >
>> > I am using enfocus where the macros can be used in this manner (from
>> > enfocus's site)-
>> >
>> > (ns my.namespace
>> >
>> >   (:require [enfocus.core :as ef])
>> >
>> >   (:require-macros [enfocus.macros :as em]))
>> >
>> > (defn start []
>> >
>> >   (em/at js/document
>> >
>> >     [“body”] (em/content “Hello world!”))
>> >
>> > However I would like to directly use the "at" and "content" macros. In
>> > clojure this can be done by importing the namespaces using the :use
>> > form.
>> > Can I do the same in clojurescript?
>> >
>> > Thanks,
>> > Murtaza
>> >
>> > --
>> > You received this message because you are subscribed to the Google
>> > Groups "Clojure" group.
>> > To post to this group, send email to clo...@googlegroups.com
>> > Note that posts from new members are moderated - please be patient with
>> > your
>> > first post.
>> > To unsubscribe from this group, send email to
>> > clojure+unsubscribe@googlegroups.com
>> > For more options, visit this group at
>> > http://groups.google.com/group/clojure?hl=en
>
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clo...@googlegroups.com
> Note that posts from new members are moderated - please be patient with your
> first post.
> To unsubscribe from this group, send email to
> clojure+unsubscribe@googlegroups.com
Reply all
Reply to author
Forward
0 new messages