Hi,

2009/3/25 ninix <nitzan....@gmail.com>

>
> Thanks.
>
> 1) The returned exception is misleading. For example, in the following
> (contrived) case:
> user=> (. obj (toString ""))
> java.lang.IllegalArgumentException: No matching method found: toString
> for class java.lang.Object
> Since the member-symbol is not evaluated, shouldn't the exception be
> (at least): ... method found: (toString ... ?


Indeed.


> 2) For runtime method resolution - Instead of calling the Clojure
> reflector methods directly (as was suggested
> in the discussion you mentioned) perhaps the dot form should attempt
> to evaluate the member-symbol; it will use
> the value if the evaluation succeeds and can still use the symbol name
> (as it currently does) if the evalution fails
> (e.g. the symbol is not bound).


I think the special operator manipulates the symbol at compile time, where
no runtime (as the evaluation of a complex expression) is possible.

That's certainly as is for a performance reason.

Maybe a more dynamic version of it (not requiring one to make calls to
internal clojure java code) could have its place in clojure-contrib ?



>
>
>
> On Mar 25, 10:06 am, Laurent PETIT <laurent.pe...@gmail.com> wrote:
> > Hello,
> >
> > No, it's not possible, dot (.) is a special form and disallows this.
> >
> > Search this mailing list for the subject "Help with the dot operator
> special
> > form" for a similar discussion on the ways to achieve more dynamic
> (runtime)
> > method resolution.
> >
> > HTH,
> >
> > --
> > Laurent
> >
> > 2009/3/25 ninix <nitzan....@gmail.com>
> >
> >
> >
> >
> >
> > > Hi,
> >
> > > Is there any way to get a "dynamic" member-symbol for use in the (.)
> > > special form?
> >
> > > For example, I get the following exception:
> > > user=> (def obj (Object.))
> > > #'user/obj
> > > user=> (. obj (symbol "f"))
> > > java.lang.IllegalArgumentException: No matching method found: symbol
> > > for class java.lang.Object
> >
> > > I expected this to behave like: (. obj f), so I can change the
> > > accessed member by changing the argument in (symbol ...), but was
> > > surprised by the result...
> >
> > > Thanks
> >
>

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