To be fair, calling from outside of Clojurescript is probably the only
use-case for this behavior that I can imagine, which is exactly what
^:export was designed (and named) for.

--
Ashton Kemerling


On Mon, Aug 25, 2014 at 12:18 PM, Thomas Heller <[email protected]> wrote:

> It is possible, the question is WHEN?
>
> You can make a function callable by name if you export it.
>
> (ns myns)
>
> (def ^:export testfn []
>   :foo)
>
> can be called like so, must be careful with name munging though:
>
> (let [the-fn (aget js/window "myns" "testfn")]
>   (the-fn))
>
> which also works with advanced compilation. I wouldn't recommend exporting
> all functions, but I do it for functions I want to use from HTML/JS.
>
> HTH,
> /thomas
>
>
> On Monday, August 25, 2014 6:09:29 PM UTC+2, David Nolen wrote:
>
>> Any such facility is at odds with Google Closure Compiler's advanced
>> compilation.
>>
>> David
>>
>> On Mon, Aug 25, 2014 at 11:59 AM, Timur <[email protected]> wrote:
>> > Hi everybody,
>> >
>> > Is there a way to resolve a function or object using its string name in
>> > ClojureScript? I found this however it is old:
>> >
>> > http://stackoverflow.com/questions/12020576/resolve-
>> function-throws-an-error-in-clojurescript-but-not-clojure/
>> 12020663#12020663
>> >
>> > Thanks in advance.
>> >
>> >
>> >
>> >
>> > --
>> > You received this message because you are subscribed to the Google
>> > Groups "Clojure" group.
>> > To post to this group, send email to [email protected]
>> > Note that posts from new members are moderated - please be patient with
>> your
>> > first post.
>> > To unsubscribe from this group, send email to
>> > [email protected]
>> > 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 unsubscribe from this group and stop receiving emails from it, send
>> an
>> > email to [email protected].
>> > For more options, visit https://groups.google.com/d/optout.
>>
>  --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to [email protected]
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> [email protected]
> 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 unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
[email protected]
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 unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to