FuSe an(other) OCaml implementation of binary sessions Luca - - PowerPoint PPT Presentation

fuse an other ocaml implementation of binary sessions
SMART_READER_LITE
LIVE PREVIEW

FuSe an(other) OCaml implementation of binary sessions Luca - - PowerPoint PPT Presentation

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 : ! .


slide-1
SLIDE 1

FuSe an(other) OCaml implementation

  • f binary sessions

Luca Padovani

1 / 8

slide-2
SLIDE 2

target API

Linear type theory for asynchronous session types (Gay & Vasconcelos 2010)

accept

:

A service → A request

:

A service → A send

: α → !α.A → A

receive

:

?α.A → α × A select

: (Ak → [Ci : Ai]i∈I) → ⊕[Ci : Ai]i∈I → Ak

branch

:

&[Ci : Ai]i∈I → [Ci : Ai]i∈I create

:

unit → A × A close

:

end → unit

2 / 8

slide-3
SLIDE 3

duality and linearity in OCaml

Turn duality into equality

◮ Dardha et al. 2012 + tweak

3 / 8

slide-4
SLIDE 4

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

slide-5
SLIDE 5

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

slide-6
SLIDE 6

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

slide-7
SLIDE 7

target API (encoded)

accept

: α, β service → α, β

request

: α, β service → β, α

send

: γ → 0, γ × β, α → α, β

receive

: γ × α, β, 0 → γ × α, β

select

: (β, α → γ) → 0, γ → α, β

branch

: γ, 0 → γ

create

:

unit → α, β × β, α close

: 0, 0 → unit

6 / 8

slide-8
SLIDE 8

DEMO

7 / 8

slide-9
SLIDE 9

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