ARx: Reactive Programming for Synchronous Connectors · Meuter. A survey on reactive programming....
Transcript of ARx: Reactive Programming for Synchronous Connectors · Meuter. A survey on reactive programming....
![Page 1: ARx: Reactive Programming for Synchronous Connectors · Meuter. A survey on reactive programming. ACM Comput. Surv., 2013. Reactive variables Triggered if b is updated Triggered if](https://reader035.fdocuments.net/reader035/viewer/2022071019/5fd379ab5f19bf6ee56baf45/html5/thumbnails/1.jpg)
Tools: http://arcatools.org/#arx Tools: http://arcatools.org/#arx
ARx: Reactive Programming for
Synchronous ConnectorsJosé Proença, Guillermina Cledou
Coordination @ DisCoTec 2020
Video of the presentation: https://www.youtube.com/watch?v=74RUzfYneNI&t=2s
![Page 2: ARx: Reactive Programming for Synchronous Connectors · Meuter. A survey on reactive programming. ACM Comput. Surv., 2013. Reactive variables Triggered if b is updated Triggered if](https://reader035.fdocuments.net/reader035/viewer/2022071019/5fd379ab5f19bf6ee56baf45/html5/thumbnails/2.jpg)
Tools: http://arcatools.org/#arx Tools: http://arcatools.org/#arx
compiled to
Scala
arcatools.org/#arx
JavaScript
![Page 3: ARx: Reactive Programming for Synchronous Connectors · Meuter. A survey on reactive programming. ACM Comput. Surv., 2013. Reactive variables Triggered if b is updated Triggered if](https://reader035.fdocuments.net/reader035/viewer/2022071019/5fd379ab5f19bf6ee56baf45/html5/thumbnails/3.jpg)
Tools: http://arcatools.org/#arx Tools: http://arcatools.org/#arx
arcatools.org/#arxSyntax● Constructs● Layout
Motivation● Reactive
Languages● Synchronous
Languages
Semantics● Stream
Builders● Reactive
Interpretation
![Page 4: ARx: Reactive Programming for Synchronous Connectors · Meuter. A survey on reactive programming. ACM Comput. Surv., 2013. Reactive variables Triggered if b is updated Triggered if](https://reader035.fdocuments.net/reader035/viewer/2022071019/5fd379ab5f19bf6ee56baf45/html5/thumbnails/4.jpg)
Tools: http://arcatools.org/#arx Tools: http://arcatools.org/#arx
Syntax
lossy(a)fifo(a)drain(a,b)
c <– ac <– b
b <– ac <– a
a <~ b
Data Bool = True | False
Reo-based constructs
Reactive Variables
Algebraic data types
![Page 5: ARx: Reactive Programming for Synchronous Connectors · Meuter. A survey on reactive programming. ACM Comput. Surv., 2013. Reactive variables Triggered if b is updated Triggered if](https://reader035.fdocuments.net/reader035/viewer/2022071019/5fd379ab5f19bf6ee56baf45/html5/thumbnails/5.jpg)
Tools: http://arcatools.org/#arx Tools: http://arcatools.org/#arx
Synchronous connectors
a and bat the same time
1. get b2. block b until empty3. sent to o
drain(a,b)o <– ao <– fifo(b)o
Either● get a● get b
E.g., Reo, Lustre, Esterel( )
![Page 6: ARx: Reactive Programming for Synchronous Connectors · Meuter. A survey on reactive programming. ACM Comput. Surv., 2013. Reactive variables Triggered if b is updated Triggered if](https://reader035.fdocuments.net/reader035/viewer/2022071019/5fd379ab5f19bf6ee56baf45/html5/thumbnails/6.jpg)
Tools: http://arcatools.org/#arx Tools: http://arcatools.org/#arx
Reactive Programs (1)
...c <– Times(a,b)Plus(a,c)
From: E. Bainomugisha, A.L. Carreton, T. van Cutsem, S. Mostinckx, and W. de Meuter. A survey on reactive programming. ACM Comput. Surv., 2013.
Reactive variables
Triggered ifb is updated
Triggered if both a and care updated
E.g., Angular, Yampa, ReScala( )
![Page 7: ARx: Reactive Programming for Synchronous Connectors · Meuter. A survey on reactive programming. ACM Comput. Surv., 2013. Reactive variables Triggered if b is updated Triggered if](https://reader035.fdocuments.net/reader035/viewer/2022071019/5fd379ab5f19bf6ee56baf45/html5/thumbnails/7.jpg)
Tools: http://arcatools.org/#arx Tools: http://arcatools.org/#arx
Reactive Programs (2)Domain: Graphical users interfaces
constantly updated
sometimes updated
May requestupdated values
Dynamic dependencies
if sel then mouse else time
E.g., Angular, Yampa, ReScala( )
![Page 8: ARx: Reactive Programming for Synchronous Connectors · Meuter. A survey on reactive programming. ACM Comput. Surv., 2013. Reactive variables Triggered if b is updated Triggered if](https://reader035.fdocuments.net/reader035/viewer/2022071019/5fd379ab5f19bf6ee56baf45/html5/thumbnails/8.jpg)
Tools: http://arcatools.org/#arx Tools: http://arcatools.org/#arx
Reactive Programs (2)Domain: Graphical users interfaces
constantly updated
sometimes updated
May requestupdated values
Dynamic dependencies
if sel then mouse else time
E.g., Angular, Yampa, ReScala( )
selRx <~ seltrue,false <– match(selRx)...
![Page 9: ARx: Reactive Programming for Synchronous Connectors · Meuter. A survey on reactive programming. ACM Comput. Surv., 2013. Reactive variables Triggered if b is updated Triggered if](https://reader035.fdocuments.net/reader035/viewer/2022071019/5fd379ab5f19bf6ee56baf45/html5/thumbnails/9.jpg)
Tools: http://arcatools.org/#arx Tools: http://arcatools.org/#arx
Reactive Programs (2)Domain: Graphical users interfaces
constantly updated
sometimes updated
May requestupdated values
Dynamic dependencies
if sel then mouse else time
data Bool = True | False
selRx <~ seltrue,false <– match(selRx)...
E.g., Angular, Yampa, ReScala( )
![Page 10: ARx: Reactive Programming for Synchronous Connectors · Meuter. A survey on reactive programming. ACM Comput. Surv., 2013. Reactive variables Triggered if b is updated Triggered if](https://reader035.fdocuments.net/reader035/viewer/2022071019/5fd379ab5f19bf6ee56baf45/html5/thumbnails/10.jpg)
Tools: http://arcatools.org/#arx Tools: http://arcatools.org/#arx
Semantics
ARx Semantics via stream builders
Types
Automata semantics of stream builders
![Page 11: ARx: Reactive Programming for Synchronous Connectors · Meuter. A survey on reactive programming. ACM Comput. Surv., 2013. Reactive variables Triggered if b is updated Triggered if](https://reader035.fdocuments.net/reader035/viewer/2022071019/5fd379ab5f19bf6ee56baf45/html5/thumbnails/11.jpg)
Tools: http://arcatools.org/#arx Tools: http://arcatools.org/#arx
Stream Builder
Set of exclusive guarded
commands
guardsupdates
how to consume input/memory streams
how to write output/memory streams
Semantics with composition
x
![Page 12: ARx: Reactive Programming for Synchronous Connectors · Meuter. A survey on reactive programming. ACM Comput. Surv., 2013. Reactive variables Triggered if b is updated Triggered if](https://reader035.fdocuments.net/reader035/viewer/2022071019/5fd379ab5f19bf6ee56baf45/html5/thumbnails/12.jpg)
Tools: http://arcatools.org/#arx Tools: http://arcatools.org/#arx
Stream Builder
get destructive readund undefined value...
![Page 13: ARx: Reactive Programming for Synchronous Connectors · Meuter. A survey on reactive programming. ACM Comput. Surv., 2013. Reactive variables Triggered if b is updated Triggered if](https://reader035.fdocuments.net/reader035/viewer/2022071019/5fd379ab5f19bf6ee56baf45/html5/thumbnails/13.jpg)
Tools: http://arcatools.org/#arx Tools: http://arcatools.org/#arx
Compact representation
Stream Builder
(no state explosion)
Based on stream constraints
[Dokter and Arbab ’18]
Dokter and Arbab. Rule-based form for stream constraintsCoordination Models and Languages, 2018
![Page 14: ARx: Reactive Programming for Synchronous Connectors · Meuter. A survey on reactive programming. ACM Comput. Surv., 2013. Reactive variables Triggered if b is updated Triggered if](https://reader035.fdocuments.net/reader035/viewer/2022071019/5fd379ab5f19bf6ee56baf45/html5/thumbnails/14.jpg)
Tools: http://arcatools.org/#arx Tools: http://arcatools.org/#arx
Reactiveness
Stream Builder
baask non-destructive read
latest value always available
![Page 15: ARx: Reactive Programming for Synchronous Connectors · Meuter. A survey on reactive programming. ACM Comput. Surv., 2013. Reactive variables Triggered if b is updated Triggered if](https://reader035.fdocuments.net/reader035/viewer/2022071019/5fd379ab5f19bf6ee56baf45/html5/thumbnails/15.jpg)
Tools: http://arcatools.org/#arx Tools: http://arcatools.org/#arx
Examples
ba
ba
b always availablem0 overwritten
b only oncem0 NOT overwritten
![Page 16: ARx: Reactive Programming for Synchronous Connectors · Meuter. A survey on reactive programming. ACM Comput. Surv., 2013. Reactive variables Triggered if b is updated Triggered if](https://reader035.fdocuments.net/reader035/viewer/2022071019/5fd379ab5f19bf6ee56baf45/html5/thumbnails/16.jpg)
Tools: http://arcatools.org/#arx Tools: http://arcatools.org/#arx
Reactive Semantics
The environment controls when to read (pull) / write (push)
Push-pull interpretation
Triggered ifa is updated
Triggered ifa is updated
Or ifa is active
and the environment wants to read b
ba
![Page 17: ARx: Reactive Programming for Synchronous Connectors · Meuter. A survey on reactive programming. ACM Comput. Surv., 2013. Reactive variables Triggered if b is updated Triggered if](https://reader035.fdocuments.net/reader035/viewer/2022071019/5fd379ab5f19bf6ee56baf45/html5/thumbnails/17.jpg)
Tools: http://arcatools.org/#arx Tools: http://arcatools.org/#arx
Reactive Semantics
Push-pull interpretation via stream builder automata
![Page 18: ARx: Reactive Programming for Synchronous Connectors · Meuter. A survey on reactive programming. ACM Comput. Surv., 2013. Reactive variables Triggered if b is updated Triggered if](https://reader035.fdocuments.net/reader035/viewer/2022071019/5fd379ab5f19bf6ee56baf45/html5/thumbnails/18.jpg)
Tools: http://arcatools.org/#arx Tools: http://arcatools.org/#arx
Wrap upSynchronous + Reactive DSL
ADTs
Scala + Javascript
![Page 19: ARx: Reactive Programming for Synchronous Connectors · Meuter. A survey on reactive programming. ACM Comput. Surv., 2013. Reactive variables Triggered if b is updated Triggered if](https://reader035.fdocuments.net/reader035/viewer/2022071019/5fd379ab5f19bf6ee56baf45/html5/thumbnails/19.jpg)
Tools: http://arcatools.org/#arx Tools: http://arcatools.org/#arx
Wrap up
Reactive Semantics for SB
(with push-pull interpretation)
Synchronous + Reactive DSL
Stream builder Semantics
ADTs
Type Analysis Scala + Javascript
![Page 20: ARx: Reactive Programming for Synchronous Connectors · Meuter. A survey on reactive programming. ACM Comput. Surv., 2013. Reactive variables Triggered if b is updated Triggered if](https://reader035.fdocuments.net/reader035/viewer/2022071019/5fd379ab5f19bf6ee56baf45/html5/thumbnails/20.jpg)
Tools: http://arcatools.org/#arx Tools: http://arcatools.org/#arx
Architectural view
Reactive Semantics for SB
(with push-pull interpretation)
Wrap upSynchronous + Reactive DSL
Stream builder Semantics
ADTs
Type Analysis Scala + Javascript