You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<-c could be made a term (as in Go). For instance (<-c : A) would desugar to a receive action let x : A <- c.
Given some type inference the syntax <-c would work without type annotation.
More precisely given an action act all the occurrences (within the terms in act) of a <-c gets replaced by a fresh variable (say x_c). All the receive actions are then combined in parallel and occurs just before act.
All the channels on which we receive must then be distinct, which is enforced because of the parallel combination.
Example:
split de[d,e]
c <- (<-d : Int) + (<-e : Int)
Becomes:
split de[d,e]
(let (x_d : Int) <- d | let (x_e : Int) <- e).
c <- (x_d + x_e)
The biggest advantage of this syntax is that being shorter it pushes the programmer to write more parallel receives which leads to more convenient types.
Caveat
As mentioned in Issue #8, <-c within a local definition should have a specific syntax (using <= instead of =) to avoid suggesting that one can freely replace such definitions.
I suggest to forbid receive expression to be under additional binders. The worse would be that the type of the received message depends on such additional binder. Less critical but \(x : A)-> (recv c : B) would suggest that the receive is down when the function is called. For instance this would be rejected:
d <- (\(x : A)-> (<-c : B))
The text was updated successfully, but these errors were encountered:
In short:
* `send c t` can now be written as `c <- t`.
* `recv c (x : A)` can now be written as `let x : A <- c`.
Moreover:
* One can now use `;` in place of `.`.
* One can use the keyword `split` before splits.
* `<- c` is recognized as a term and `let x : A <= t` as an action.
These are not handled yet (Issue #16).
Finally ling-fmt as evolved to treat this syntax change:
* Albert.cf has been improved with the changes above except for the
keyword `split`. This syntax version is now frozen.
* Benjamin.cf has been created as an identical copy of Ling.cf so
far. Now when Ling.cf changes one should update Benjamin.cf.
<-c
could be made a term (as in Go). For instance(<-c : A)
would desugar to a receive actionlet x : A <- c
.Given some type inference the syntax
<-c
would work without type annotation.More precisely given an action
act
all the occurrences (within the terms inact
) of a<-c
gets replaced by a fresh variable (sayx_c
). All the receive actions are then combined in parallel and occurs just beforeact
.All the channels on which we receive must then be distinct, which is enforced because of the parallel combination.
Example:
Becomes:
The biggest advantage of this syntax is that being shorter it pushes the programmer to write more parallel receives which leads to more convenient types.
Caveat
As mentioned in Issue #8,
<-c
within a local definition should have a specific syntax (using<=
instead of=
) to avoid suggesting that one can freely replace such definitions.I suggest to forbid receive expression to be under additional binders. The worse would be that the type of the received message depends on such additional binder. Less critical but
\(x : A)-> (recv c : B)
would suggest that the receive is down when the function is called. For instance this would be rejected:The text was updated successfully, but these errors were encountered: