2011/8/1 Arthur Edelstein <arthuredelst...@gmail.com> > > > > One option is (. target :slot), possibly with the not-so-great > (.:slot > > > > target) as well. > > > > > Why not simply (target :slot) and (:slot target) as one means of > > > > (:slot target) would do what, when facing an object which implements the > > Associative interface ? > > Here's what I was trying to say. Assume that target is a javascript > object. > > For the colon syntax: > If member is a field, then > (:member target) would return the value of the field. > If member is a method, then > (:member target) would return a function object (that is, the value of > the member field, which is a function), and > ((:member target)) would execute the function. > > This is sensible because javascript-style objects are associative > arrays. > > For the dot syntax: > If member is a method, then > (.member target) would execute the function. > If member is a field, then > (.member target) would return the value of the field. > This is entirely consistent with clojure's existing syntax. > > My feeling is this is the smallest possible perturbation to clojure's > behavior. The dot notation semantics don't change at all, and the > colon syntax is also essentially the same, with the handy addition > that because javascript contains first-class functions, you can treat > javascript objects as Associatives, whereas in general you can't treat > Java objects as associatives. >
Wasn't Rich trying to come up with a solution which could be retrofitted into Clojure ? > > Arthur > > -- > 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