The Glasgow Haskell Compiler is known for its feature-laden runtime system (RTS), which includes lightweight threads, asynchronous exceptions, and a slew of other features. Their combination is powerful enough that a programmer may complete the same task in many different ways -- some more advisable than others. We present a user-accessible actor framework hidden in plain sight within the RTS and demonstrate it on a classic example from the distributed systems literature. We then extend both the framework and example to the realm of dynamic types. Finally, we raise questions about how RTS features intersect and possibly subsume one another, and suggest that GHC can guide good practice by constraining the use of some features.
翻译:Glasgow Haskell 编译器以其功能丰富的运行时系统(RTS)著称,该系统包含轻量级线程、异步异常及其他众多特性。这些特性的组合足够强大,以至于程序员可以通过多种不同方式完成同一任务——其中某些方式比其他方式更可取。我们提出了一个隐藏在RTS中、用户可访问的角色框架,并基于分布式系统文献中的经典示例对其进行了演示。随后,我们将该框架及示例扩展至动态类型领域。最后,我们提出关于RTS特性如何相互交叉甚至可能彼此替代的问题,并建议GHC可通过限制某些特性的使用来引导良好实践。