gshen42 / HasChor

Functional choreographic programming in Haskell
https://gshen42.github.io/HasChor/
BSD 3-Clause "New" or "Revised" License
78 stars 13 forks source link

fix EPP of sending a value to oneself #12

Closed ShapeOfMatter closed 9 months ago

ShapeOfMatter commented 9 months ago

This is a pretty tiny fix; as currently written Endpoint Projection of an (A, x) ~> A operation will cause A to "own" (and subsequently unwrap) an Empty.

Instead of this fix, one might consider forbidding self-sends altogether, but there's no particular reason why they should be illegal. One might also consider handling them specially as no-ops, but we can imagine cases where the network send and recv get assigned specialized side-effects that shouldn't be skipped.

The repo doesn't have any unit tests. I've done the bare minimum of running one of the example programs to make sure I didn't break anything. If there's any book-keeping that should accompany a patch like this; I haven't done it.

gshen42 commented 9 months ago

Thanks! I changed the behavior of sending a value to oneself to return the value immediately and tweaked the style a bit.

gshen42 commented 9 months ago

Hmm, interesting. I merged this, but GitHub somehow says it's closed. Anyway, thanks again.