Re: dynamic member-symbol in (.) form

2009-03-25 Thread Stuart Sierra
On Mar 24, 8:48 pm, ninix wrote: > Is there any way to get a "dynamic" member-symbol for use in the (.) > special form? Nope. Your options are 1) use the Java reflection API; or 2) use Clojure's internal reflection methods. I recommend (1), because that's a well-defined API. It wouldn't be too

Re: dynamic member-symbol in (.) form

2009-03-25 Thread Laurent PETIT
Hi, 2009/3/25 ninix > > 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 eva

Re: dynamic member-symbol in (.) form

2009-03-25 Thread ninix
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

Re: dynamic member-symbol in (.) form

2009-03-25 Thread Laurent PETIT
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 > > Hi, >

dynamic member-symbol in (.) form

2009-03-24 Thread ninix
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