Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dependent sessions #10

Open
np opened this issue Oct 14, 2015 · 0 comments
Open

Dependent sessions #10

np opened this issue Oct 14, 2015 · 0 comments

Comments

@np
Copy link
Owner

np commented Oct 14, 2015

Two kinds of dependencies should be supported at first.

Simple dependencies: indexing

(this is supported since 5657a0a)

Example:

dep_fun_server =
  \(A : Type)
   (B : (x : A)-> Type)
   (f : (x : A)-> B x)->
   proc(c : ?(x : A). !B x)
   recv c (x : A).
   send c (f x)

Large-elimination over finite data types

Example:

case_fun_server =
  proc(c : ?(x : Bool). case x of { `true -> !String, `false -> {!String,!String} })
  recv c (x : Bool).
  case x of
    `true -> send c "Hello World!"
    `false ->
       c{d,e}
       send d "Hello".
       send e "World"

However since case is not part of process but of terms the example above is rejected, instead one can write:

case_fun_server =
  proc(c : ?(x : Bool). (case x of { `true -> !String, `false -> {!String,!String} }))
  recv c (x : Bool).
  @(case x of
    `true -> proc (c) send c "Hello World!"
    `false ->
       proc (c)
       c{d,e}
       send d "Hello".
       send e "World"
  )(c)

Which is rejected so far with the following message:

Expected a protocol type, not:
case x of {
  `false -> < {!String, !String}> ,
  `true -> < !String >
}

Here the fix seems straightforward the type above should be equivalent to:

< case x of { `false -> {!String, !String} , `true -> !String } >
@np np added the enhancement label Oct 14, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant