Re: Doubt about "pull phase should invoke the transform phase"

97 views
Skip to first unread message

Zach Tellman

unread,
Jun 8, 2019, 11:50:00 PM6/8/19
to Devices For, Elements of Clojure
The simple REPL example is *not* a robust process, because it doesn't make decisions about what happens when `read`, `eval`, or `print` fail.  Should we try to address these failure modes, we'd want the error handling to exist at the edge of the process.  We don't want, for instance, for `eval` to have to think about what happens when `read` fails due to a malformed input or an I/O failure.   That's totally orthogonal to the evaluation itself.

This is oversimplifying a bit, but the core of the process should focus on the happy-path, and the code around it should allow it to pretend that only the happy-path exists. If the core of the process is invoking the edge, it has to start thinking about exception handling, etc which breaks the separation of concerns.

Hope that helps,
Zach


On Wed, May 29, 2019 at 7:08 PM, Devices For <devic...@gmail.com> wrote:
Hello,

On page 108 of the PDF, the sentence "In a robust process, the pull phase should invoke the transform phase." confused me with the "invoke" part in relation to the REPL example shown earlier:

(defn repl [read eval print]
 
(loop []
   
(->> (read)
     
eval
     
print)
 
(recur)))


Assuming this function represents a "robust process" (not a real complete example obviously),  the result of (read), the pull phase, is being passed to eval, the transform phase, as an argument. The pull phase is not invoking eval.

How would the pull phase invoke the call phase here to make the process more robust?

A probably wrong theory of mine: the meaning of "In a robust process, the pull phase should invoke the transform phase" in this example would mean that the pull phase(read) should invoke eval first to see if it is available to receive data.

Yep, confused ;)

--
You received this message because you are subscribed to the Google Groups "Elements of Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elements-of-clojure+unsubscribe@googlegroups.com.
To post to this group, send email to elements-of-clojure@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elements-of-clojure/edfb8222-54fa-4759-9e30-da8aa50a07ed%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages