Alright, thanks for the info. Do you know why an automatic solution is
out?

I'm trying to use D3 from ClojureScript, but right now all of the
clarity I get from Clojure's nicer data manipulation abstractions is
lost having to convert to/from JS objects everywhere.


On Aug 11, 9:27 am, Brenton <bashw...@gmail.com> wrote:
> There is an issue for this:
>
> http://dev.clojure.org/jira/browse/CLJS-37
>
> and work is being done to come up with a good solution. The comment in
> the issue is outdated. There was some discussion last week about how
> best to do this. I can't remember the details but I know that doing
> anything automatically is out. I think it will either be a macro or a
> reader-macro and will only create js objects out of literals or
> expressions which can be evaluated to a literal.
>
> Brenton
>
> On Aug 10, 9:04 pm, Kevin Lynagh <klyn...@gmail.com> wrote:
>
> > What is the best way to pass Clojure vectors and maps to JavaScript
> > functions?
>
> > Currently when I need to call a JavaScript function that takes an
> > array I do something like
>
> >     (js/my_js_fn (.array (vector 1 2 3)))
>
> > and I pass Clojure maps like
>
> >     (js/my_js_fn (.strobj (hash-map "a" 1 "b" 2)))
>
> > This feels a bit gross, since I'm digging into the implementation
> > details.
>
> > Is there a recommended way to do this yet?
> > Some kind of reader macro (say @@) would be okay, turning
>
> >     (js/my_js_fn @@(vector 1 2 3))
>
> > into
>
> >     (js/my_js_fn (.array (vector 1 2 3)))
>
> > at read time.
>
> > Ideally though, the compiler would automatically convert ClojureScript
> > objects into JavaScript native objects when they're passed to a
> > function in the js/ namespace.
>
>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@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+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to