I suspect it's because queuing up operations is a relatively safe increment in convenience over the most naive implementation: having to wait for each evaluation to complete before submitting the next.
Attempting to increasing the convenience further by evaluating expressions in parallel incurs the risk that a given evaluation might produce a side effect (e.g., a state change) that a later evaluation depends on. --Steve On Wednesday, May 2, 2018 at 6:48:46 AM UTC-4, Carlo Zancanaro wrote: > > Hey there! > > With tools.nrepl, if you eval two expressions they get queued up > and evaluated in sequence. This means that if I evaluate > (Thread/sleep 10000), and then immediately evaluate (+ 1 2), then > I have to wait ten seconds for the result of 3 to come back. > > Is there a particular reason for this? Given that it's quite easy > to make it evaluate them in parallel, I figure there's a reason > why it was decided to evaluate them in sequence. > > I have a use-case where I would like to be able to run evaluations > in parallel without having to wrap everything in (future ...), so > I'm considering writing some middleware to redefine > clojure.tools.nrepl.middleware.interruptible-eval/queue-eval to > just put things straight on the executor. It seems to work from my > limited tests, but are there any reasons why this would break > horribly? > > Carlo > -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to [email protected] Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to [email protected] 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 [email protected]. For more options, visit https://groups.google.com/d/optout.
