RxAda: An Ada implementation of the ReactiveX API
The ReactiveX API, also known as the Reactive Extensions in the .NET world, is a recently popularized reactive programming framework for asynchronous, event-based, multi-threaded programming. Presented by its proponents as a solid tool for applications requiring a simple yet powerful approach to event-driven systems, it has seen favorable adoption in many popular languages. Although Ada has been long-favored by powerful tasking capabilities that reduce the need for additional multi-threading support, the reactive approach has properties that are well-suited to the safety and maintainability culture predominant in the Ada world, such as complexity reduction, race-condition and deadlock avoidance, and enhanced maintainability by means of concise and well-defined information flows. This work presents the design for a ReactiveX Ada implementation that aims to balance desirable library properties such as compile-time checks, reasonable user-required generic instantiations, and a shallow learning curve for both library clients and maintainers. The Ada programmer can henceforth benefit from the abundant documentation existing for the language-agnostic ReactiveX approach without stepping out of the Ada tool chain.
KeywordsReactiveX Observer pattern Reactive programming Ada 2012
This work has been supported by projects RoboChallenge (DPI2016-76676-R-AEI/FEDER-UE) and Alerta (CUD2016-17). The author thanks the regulars at comp.lang.ada for insightful discussions and the AdaCore support team for their prompt response to bugs uncovered during RxAda development.
- 1.Bainomugisha, E., Carreton, A.L., Cutsem, T.V., Mostinckx, S., Meuter, W.D.: A survey on reactive programming. ACM Comput. Surv. 45(4), 52:1–52:34 (2013)Google Scholar
- 2.Bonér, J., Farley, D., Kuhn, R., Thompson, M.: The Reactive Manifesto (2014). http://www.reactivemanifesto.org/
- 4.Edwards, J.: Coherent reaction. In: Proceedings of the 24th ACM SIGPLAN Conference Companion on Object Oriented Programming Systems Languages and Applications, OOPSLA 2009, pp. 925–932. ACM, New York (2009)Google Scholar
- 5.Elliott, C.M.: Push-pull functional reactive programming. In: Proceedings of the 2nd ACM SIGPLAN Symposium on Haskell, Haskell 2009, pp. 25–36. ACM (2009)Google Scholar
- 6.Gamma, E., Helm, R., Johnson, R., Vlissides, J.: Design Patterns: Elements of Reusable Object-Oriented Software. Addison-Wesley Longman, Inc., Boston (1995)Google Scholar
- 7.Maglie, A.: ReactiveX and RxJava. In: Reactive Java Programming, pp. 1–9. Springer, New York (2016)Google Scholar
- 8.Mosteo, A.R.: RxAda (2017). https://bitbucket.org/amosteo/rxada
- 9.Salvaneschi, G., Margara, A., Tamburrelli, G.: Reactive programming: a walkthrough. In: 2015 IEEE/ACM 37th IEEE International Conference on Software Engineering, vol. 2, pp. 953–954, May 2015Google Scholar
- 10.ReactiveX: An API for asynchronous programming with observable streams. http://reactivex.io/
- 11.Rx design guidelines. https://blogs.msdn.microsoft.com/rxteam/2010/10/28/rx- design-guidelines/
- 12.Thornley, J.: Parallel programming with declarative Ada. Technical report, Caltech (1993)Google Scholar
- 13.Wan, Z., Hudak, P.: Functional reactive programming from first principles. In: Proceedings of the ACM SIGPLAN 2000 Conference on Programming Language Design and Implementation, PLDI 2000, pp. 242–252. ACM, New York (2000)Google Scholar