On Mon, Sep 17, 2012 at 11:26 AM, Matt Campbell <mattcampb...@pobox.com> wrote:
> I noticed that cljs.core redefines String.prototype.apply. Being new to
> Clojure, I don't understand what this redefinition does or what it is for.
> But I do know that redefining functions in the JS standard library, or
> defining new ones on standard objects, is something that should be done with
> great care, to avoid breaking other pieces of JavaScript running in the same
> context (e.g. on the same page). (And lest you think your JavaScript is sure
> to be the only JavaScript on your page, bear in mind that some browsers make
> web pages accessible to blind users by injecting their own JS into the
> page.)
>
> I know there are always trade-offs. And perhaps this definition of
> String.prototype.apply is known not to conflict with any other JavaScript
> code. But I would appreciate an explanation of what purpose it serves.
>
> Thanks,
> Matt

It's a yucky bit of code that needs to be removed. It's there to
support using keywords as functions - in ClojureScript keywords are
just JS Strings.

David

-- 
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