ClojureScript One

179 views
Skip to first unread message

Pierre-Henry Perret

unread,
May 27, 2012, 6:25:07 AM5/27/12
to clo...@googlegroups.com
Sometimes, I dont know when/why, I get the following response from clj-repl:

WARNING: The form (. this toString) is no longer a property access. Maybe you meant (. this -toStrin
g) instead?

I use the M003 branch of cj One 

Have any idea ?

Jonathan Fischer Friberg

unread,
May 27, 2012, 7:03:53 AM5/27/12
to clo...@googlegroups.com
When clojurescript first came out

(.toString this)
(.toString this 3)

both of these seems to be a function call, but the first one was transformed to

(. this toString)

and because there is no way to know if the user meant to call the function "toString"
or get the property "toString", it returned the property "toString".

In other words, (.toString this) didn't actually call the function "toString", instead, it returned the property "toString".

At some point this was changed to (.toString this) always meaning call the function "toString", and
(.-toString this) meaning retrieve the property "toString".

Thus, the warning you see was put in to warn the user that (.toString this) no longer means retrieving the property "toString".
That means that whenever you do a (.fn obj) call, the warning will pop up. Note that it doesn't have be your code that
does this call, it can also be any code that you load.

http://dev.clojure.org/display/design/Unified+ClojureScript+and+Clojure+field+access+syntax

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

Reply all
Reply to author
Forward
0 new messages