You may be able to achieve what you want by directly accessing
Clojure's reflector class instead of using the special form:
user=> (clojure.lang.Reflector/invokeInstanceMethod
  "Hello" "substring" (to-array [1 2]))
"e"
There is also invokeStaticMethod (and others).


Regards,
Tim.


On Mar 22, 12:04 pm, David Nolen <dnolen.li...@gmail.com> wrote:
> I'm wondering if it's possible to create a Clojure function that does what
> the dot operator does. It seems like this would be possible with definline
> but I'm unable to get this to work or figure it out.  For example I want to
> be able write something like the following:
> (dot "Hello world" (list 'substring 1 2))
>
> Trying to use definline like this:
>
> (definline dot
>   [obj member-exp]
>   `(. ~obj (~...@member-expr)))
>
> Simply throws an error.
>
> I don't need variable arity, I will always pass an instance or class
> following by a list representing the member expression.
>
> Is this impossible?
>
> It seems like this would be generally useful to allow variable method
> calling on Java objects. As to why I want it to implement this, it would be
> far simpler to support Java interop from clj-cont if the dot operator could
> be expressed as a Clojure function.
>
> Thanks!
> David
--~--~---------~--~----~------------~-------~--~----~
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