On Fri, Jan 3, 2014 at 4:43 PM, Timothy Washington <twash...@gmail.com>wrote:
> The crux of the problem is that the size of *params* can be variable. > Only at runtime, does the code match the loaded *afn*, with the passed in > *params*. So I basically just need to break out the *~@params* into > individuated input arguments. The only other way I can think to do that, > without using eval, would be to curry afn, for each input param. > Can you just use `apply`? > > > Tim Washington > Interruptsoftware.com <http://interruptsoftware.com> > > > On Fri, Jan 3, 2014 at 7:20 PM, Jason Wolfe <ja...@w01fe.com> wrote: > >> Glad to help. >> >> I admittedly haven't taken the time to understand what's going on in your >> code, but whenever I see `eval` I feel compelled to ask: are you sure you >> need it? >> >> With that out of the way, here's a trick I've used to work around related >> errors: >> >> https://groups.google.com/d/msg/clojure/BZwinR2zNgU/8HGOgzOxzosJ >> >> Best, >> Jason >> >> On Friday, January 3, 2014 3:18:22 PM UTC-8, frye wrote: >> >>> Hey Jason, >>> >>> You were exactly right (which is pretty impressive, being that you've >>> never seen my code). In my (s/defn ..) form, there was an error that was >>> failing silently. >>> >>> (s/defn [one two] >>> ... >>> *#_(def params (atom '({}) ))* >>> (def params '({})) >>> (try (eval `(~afn ~@params)) (catch Exception e (println "Exception: >>> " (.getMessage e))))) >>> >>> >>> So the abouve code works. But if I instead use the commented version, >>> I'll get an exception. It seems there's a problem passing in a form >>> containing an atom to be dynamically eval'd. The error is mentioned on >>> these posts (here <http://clojure-log.n01se.net/date/2009-03-02.html>and >>> here<http://www.raynes.me/logs/irc.freenode.net/clojure/2012-09-17.txt#>). >>> Is there a way to pass in a form containing an atom to be dynamically >>> eval'd? It's pretty important to my architecture, that all functions treat >>> that system-atom the same. Any insights are welcome. >>> >>> *"java.lang.RuntimeException: Can't embed object in code, maybe >>> print-dup not defined: clojure.lang.Atom@1c99db7 (NO_SOURCE_FILE:0)"* >>> >>> >>> >>> Thanks >>> >>> Tim Washington >>> Interruptsoftware.com <http://interruptsoftware.com> >>> >>> >>> On Fri, Jan 3, 2014 at 2:39 PM, Jason Wolfe <ja...@w01fe.com> wrote: >>> >>>> Thanks for the report. >>>> >>>> Schema fns inside of go blocks seem to work fine for me. It seems >>>> likely that you're seeing an exception inside the go block, which is >>>> swallowed by default: >>>> >>>> user> (clojure.core.async/go (println "A")) >>>> #<ManyToManyChannel clojure.core.async.impl.channels.ManyToManyChannel@ >>>> 46ae10a6> >>>> A >>>> >>>> user> (clojure.core.async/go (throw (RuntimeException.)) (println "A")) >>>> #<ManyToManyChannel clojure.core.async.impl.channels.ManyToManyChannel@ >>>> 427c78c1> >>>> >>>> Would you mind wrapping the body of your go block in a try/catch and >>>> printing the exception stack trace, or posting a gist that demonstrates the >>>> issue so I can look into it further? >>>> >>>> Thanks! >>>> >>>> >>>> On Friday, January 3, 2014 10:21:16 AM UTC-8, frye wrote: >>>> >>>>> Forwarding... >>>>> >>>>> ---------- Forwarded message ---------- >>>>> From: Timothy Washington <twas...@gmail.com> >>>>> Date: Fri, Jan 3, 2014 at 1:17 PM >>>>> Subject: Re: Core.async, Rules for passing clojure vals to go block >>>>> To: Shaun Gilchrist <shaun...@gmail.com> >>>>> >>>>> >>>>> I'm using Prismatic's Schema in my code base. Now, it looks like >>>>> defining some functions with >>>>> s/defn<https://github.com/Prismatic/schema/blob/master/src/clj/schema/macros.clj#L453>, >>>>> yields some wonky behaviour. Particularly, not running, when being invoked >>>>> in a go block. It just fails silently, which is why it was so hard to >>>>> track >>>>> down. Don't yet know why this is happening. But an fyi for the devs and >>>>> users of this package. Still love schema, I just need to figure out where >>>>> the call chain breaks down. >>>>> >>>>> >>>>> Hth >>>>> >>>>> Tim Washington >>>>> Interruptsoftware.com <http://interruptsoftware.com> >>>>> >>>>> >>>>> On Fri, Jan 3, 2014 at 9:58 AM, Timothy Washington >>>>> <twas...@gmail.com>wrote: >>>>> >>>>>> Hey Shaun, >>>>>> >>>>>> Thanks for looking into this. Your example does indeed work. I'll >>>>>> have to teardown my own code and see where the invocations are failing. >>>>>> At >>>>>> least I know it's not core.async. >>>>>> >>>>>> >>>>>> Cheers >>>>>> >>>>>> Tim Washington >>>>>> Interruptsoftware.com <http://interruptsoftware.com> >>>>>> >>>>>> -- > -- > 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 a topic in the > Google Groups "Clojure" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/clojure/j8QWNnFNIVg/unsubscribe. > To unsubscribe from this group and all its topics, send an email to > clojure+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/groups/opt_out. > -- -- 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 unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.