Guest User

Untitled

a guest
Aug 19th, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.02 KB | None | 0 0
  1. “Assuming that `get` exists, and has ‘nothingness-result’ implementation (i.e. it never re-stages
  2. the caller if it has no result.)”
  3. {
  4. getter <- {
  5. association <- infrastructure unaffix() (infrastructure execution get.locals() ())
  6. callee <- infrastructure branch() (infrastructure get)
  7.  
  8. “First off, we have ownership from the outer caller on the association. We’re going to
  9. transfer that to the callee that may return nothingness.”
  10. infrastructure own() (callee) (association)
  11.  
  12. “Now we create an empty list, and try to get a member of that list that doesn’t exist.”
  13. a.list <- infrastructure empty create()
  14. return.value <- callee() (a.list) (1)
  15.  
  16. “We will only be called-back by the callee *if* it has a result; no return value represents a
  17. nothingness-result. If we have a result from the callee, we set it on the
  18. variable-association we share with the outer-caller.”
  19. infrastructure set() (association) (2) (return.value)
  20.  
  21. “FIXME: If the callee re-stages the getter, and then immediately terminates, the ownership
  22. will *leak* to the outer caller! This is because the outer caller is in the queue *before*
  23. the re-staging of the getter, which will allow it to grab ownership first.”
  24.  
  25. “Finally, we never do anything else with the ownership on the association, as our own
  26. realization-to-completion will ensure we throw away that ownership, and the same applies to
  27. our callee.”
  28. }
  29.  
  30. “Create a new association, storing a default value; then inject that association into the
  31. getter’s namespace such that the variable is shared with our namespace (psuedo-scoping.)
  32. Immediately after storing the value, we pop it off of our scope (storing the association itself
  33. in a new association — ‘storing the variable in a variable’), and then push it back onto our
  34. scope *and* the getter’s scope.”
  35. result <- “default value”
  36. association <- infrastructure unaffix() (infrastructure execution get.locals() ())
  37. infrastructure affix() (infrastructure execution get.locals() () ) (association)
  38. infrastructure affix() (infrastructure execution get.locals() (getter)) (association)
  39.  
  40. “We own the variable (to give us the rights to give it away,) then share our ownership with the
  41. getter, finally disowning it ourselves (to ensure we have contention against the getter until it
  42. implicitly gives up the variable) before staging the getter. This leaves us running (as we used
  43. an explicit stage, instead of the call-pattern staging,) and then we immediately contend that
  44. variable again.”
  45. infrastructure execution own() () (association)
  46. infrastructure execution own() (getter) (association)
  47. infrastructure execution disown() () (association)
  48. infrastructure execution stage() (getter) ;“First time we actually stage the getter.”
  49. infrastructure execution own() () (association)
  50.  
  51. debuggingPrint() (result)
  52. }
Add Comment
Please, Sign In to add comment