user=> ((eval `(fn [x#] (~(symbol ".setFileSelectionMode") x# 1))) jfc) nil user=>
On Thu, Oct 29, 2009 at 6:38 AM, Meikel Brandmeyer <m...@kotka.de> wrote: > > Hi, > > On Oct 29, 2:07 pm, Tiago Antão <tiagoan...@gmail.com> wrote: > >> The eval form still shows some problems, if I do this preparation: >> >> (import javax.swing.JFileChooser) >> (def jfc (new JFileChooser)) >> >> And then do: >> >> user=> (.setFileSelectionMode jfc 1) >> nil >> >> All good here, but, if I do the eval variation, >> user=> (eval (list (symbol ".setFileSelectionMode") jfc 1)) > > Another example which shows that eval is not worth the trouble. It is > better to use reflection. You cannot embed the JFileChooser as a > object into the code. You have to construct it in your eval. (eval ` > (let [chooser# (JFileChooser.)] (~(symbol ".setFileSelectionMode") > chooser# 1) chosser#)). > > Hopes this helps. > > Sincerely > Meikel > > > > -- And what is good, Phaedrus, And what is not good— Need we ask anyone to tell us these things? --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---