FuSe an(other) OCaml implementation of binary sessions Luca Padovani 1 / 8
target API Linear type theory for asynchronous session types (Gay & Vasconcelos 2010) : A service → A accept : A service → A request send : α → ! α . A → A : ? α . A → α × A receive : ( A k → [C i : A i ] i ∈ I ) → ⊕ [C i : A i ] i ∈ I → A k select : &[C i : A i ] i ∈ I → [C i : A i ] i ∈ I branch : unit → A × A create : end → unit close 2 / 8
duality and linearity in OCaml Turn duality into equality ◮ Dardha et al. 2012 + tweak 3 / 8
duality and linearity in OCaml Turn duality into equality ◮ Dardha et al. 2012 + tweak Ostrich approach to linearity ◮ no type-based mechanism, no monads, . . . ◮ affinity violations detected at runtime (Tov & Pucella 2010, Hu & Yoshida 2016) ◮ some (many?) violations detected by OCaml anyway 3 / 8
duality ⇒ equality Session types revisited (Dardha et al., PPDP 2012) � T � = κ [ t ] � ! t . T � = ![ t × � T � ] � ? t . T � = ?[ t × � T � ] � T � = κ [ t ] ⇒ � T � = κ [ t ] 4 / 8
duality ⇒ equality Session types revisited + tweak (Dardha et al., PPDP 2012) � T � = � t , s � � ! t . T � = � 0 , t × � T � � � ? t . T � = � t × � T � , 0 � � T � = � t , s � ⇒ � T � = � s , t � 5 / 8
target API (encoded) accept : � α, β � service → � α, β � : � α, β � service → � β, α � request : γ → � 0 , γ × � β, α �� → � α, β � send : � γ × � α, β � , 0 � → γ × � α, β � receive : ( � β, α � → γ ) → � 0 , γ � → � α, β � select : � γ, 0 � → γ branch create : unit → � α, β � × � β, α � : � 0 , 0 � → unit close 6 / 8
DEMO 7 / 8
wrap-up ◮ GV-style sessions (Gay & Vasconcelos, JFP 2010) ◮ context-free session types (Thiemann & Vasconcelos, ICFP 2016) ◮ subtyping (Gay & Hole, Acta 2005) ◮ chaperone contracts (ongoing with Hernán Melgratti) References ◮ FuSe details and implementation (Padovani, JFP 2017) ◮ context-free session types in FuSe (Padovani, ESOP 2017) 8 / 8
Recommend
More recommend