links-lang / links

Links: Linking Theory to Practice for the Web
http://www.links-lang.org
Other
332 stars 42 forks source link

Simpler PID synonym for processes #1156

Closed SimonJF closed 2 years ago

SimonJF commented 2 years ago

The current Process type gives the type of effects that a process can perform. When using actor style concurrency, this will typically be of the form

Process({hear: Foo})

for some message of type Foo. (I often forget the specific syntax).

Indeed this is a fairly common use case. Especially when writing MVU applications, it's often good practice to write down type signatures for PIDs if they're contained within a model.

This small patch introduces a synonym Pid(A) = Process({hear: A}) for some type A, so we can just write

Pid(Foo)

This won't be flexible enough for some cases where we want the more fine-grained reasoning about the effects performed by the spawned process, but IMO it's an easy win for a majority of cases.

SimonJF commented 2 years ago

Agreed, that would be lovely.