Advertisement
Guest User

Untitled

a guest
Oct 19th, 2019
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.05 KB | None | 0 0
  1. # Abilities tutorial
  2. ## Introducing abilities
  3. ## Motivation
  4. > Why does Unison have abilities, when so many languages get by without them?
  5.  
  6. But wait, what /are/ abilities?
  7. What is an “effectful behavior”? Maybe define the term after the examples.
  8.  
  9. Note: I’d recommend numbering the “why”s, otherwise I find the section headings grammatically confusing.
  10.  
  11. > If it made a request to a network server, or opened a file on disk, then the code is not equivalent - it produces different network or filesystem traffic, and depending on external factors (like what the server returns), might yield a different return value.
  12.  
  13. I think this is a bit too abstract. It might be easier at this point to ascribe some more tangible effect to `g` than just network or filesystem traffic, and it would also be good IMO if the modified version of `f` was somehow accidentally worse than the original, due to our not realizing that `g` was effectful! But I haven’t been able to think of a good example. As a reader, I’m not convinced of the conclusion that “it’s important to know whether `g` is effectful.” Maybe `g` dispenses candy somewhere, and my innocent refactor is depriving a child of diabetes? :)
  14.  
  15. As I continue to read the Motivation section, I worry that it continues to discuss abilities in ways that haven’t yet been introduced. Maybe it would make more sense later in the document? But let’s come back to this later.
  16.  
  17. ## Using abilities
  18. Whew, I <3 examples.
  19.  
  20. In terms of terminology, we’d say that an ability defines a set of “operations”; when you want to utilize an operation in your code, /that’s/ the “request”.
  21.  
  22. > The only non-obvious thing here is
  23.  
  24. Newcomer: “If that’s the only thing here that’s supposed to be non-obvious, then I give up!”
  25.  
  26. Maybe drop that line, and then something like:
  27. > Remember that when an expression /expr/ has type /t/, /‘expr/ has type /() -> t/ — a function which must be forced with `!` to run its computation. See [delayed computations] for more detail.
  28.  
  29. * Somehow find a way to make your em-dashes render as em-dashes?
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement