> Well, Showdown is not really a namespace right?  It's an object in the
> global environment.  You should be able to grab it via js/Showdown and do
> all kinds of interopey things to it.

Right, I totally agree. Where the problem occurs though in this
particular scenario is when :optimizations is set to `advanced`.

Code:
(. (js/Showdown.converter.) makeHtml b-txt safe)


Code with optimizations set to `simple`:

goog.dom.htmlToDocumentFragment.call(null,(new
goog.global.Showdown.converter).makeHtml(a,"false")
-> <p>working</p>


Code with optimizations set to `advanced`:

vd.call(i,(new q.Showdown.converter).Fb(b,"false")
-> TypeError: Object [object Object] has no method 'Fb'

The makeHtml got renamed to `Fb`.

Isn't this what the Google Closure `externs`[1] compiler flag is meant
to solve? (Also see `load-externs` function in clj/cljs/closure.clj)

-Al

[1] http://code.google.com/closure/compiler/docs/api-tutorial3.html#comptoex


On Aug 5, 11:00 pm, Michael Fogus <mefo...@gmail.com> wrote:
> Well, Showdown is not really a namespace right?  It's an object in the
> global environment.  You should be able to grab it via js/Showdown and do
> all kinds of interopey things to it.
>
>  On Aug 5, 2011 4:27 PM, "Alen Ribic" <alen.ri...@gmail.com> wrote:
>
>
>
>
>
>
>
> > Thanks Fogus for clearing that up.
>
> > Would a call to a constructor function in a namespace of a third-party
> > library be an exception for the time being? (I can't seem to see a
> > clear way you can express that via `js` namespace.)
>
> > Example:
> >> new Showdown.converter().makeHtml(~{b-txt},~{safe})
> > Showdown is the namespace and the converter function is the
> > constructor.
>
> > -Al
>
> > On Aug 5, 8:57 pm, Fogus <mefo...@gmail.com> wrote:
> >> To access global JavaScript interop thingies (a technical term) you
> >> should use the `js` namespace.  The use of `js*` should be considered
> >> a bad idea.  It's used in core, but only for very low-level
> >> operations.  It should be considered undocumented and therefore off-
> >> limits (we're working to eliminate its need).
>
> >> Look at code at the following link to see a very simple way to access
> >> global js functions:
>
> >>https://gist.github.com/1127895
>
> >> Let us know if that helps.
>
> > --
> > 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

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