Oh, thanks for the explanation.

I looked at the twitterbuzz code before replying, saw the function
calls with arguments written the usual way, and (erroneously) decided
it would be the same for the zero-arity calls. But it's there in the
wiki.

On Aug 1, 5:17 pm, Chouser <chou...@gmail.com> wrote:
> In Clojure you are correct, as that is unambiguous on the JVM.
> However, in JavaScript the meaning of that expression is ambiguous and
> so ClojureScript always treats (.foo bar) as *field* access, not a
> method call.  So in the above example, iframe will be equal to the
> *function* getEditableframe.
>
> There are two options if you want to call a method with no arguments:
> 1. (. obj (method))  ; As shown by Brian above
> 2. (.method obj ())
>
> They're both ugly, but valid syntax in Clojure and ClojureScript.
> Actually, style (1) is "classic" Clojure and used to be the only word
> order for doing host method calls.
>
> Anyway, Rich has expressed a preference for style (1).
>
> I'm personally ambivalent -- I might prefer the potential of someone
> reading to code mistakenly thinking () is an empty list to them
> thinking that (method) is a normal function call.  Actually, I'm still
> hoping we'll be able to come up with something less ugly that is
> nevertheless consistent with normal Clojure syntax.  I have no idea
> what that would be.
>
> --Chouser

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