We explore type systems and programming abstractions for the safe use of resources. In particular, we investigate how to use types to modularly specify and check when programs are allowed to use their resources, e.g., when programming a robot arm on a production line, it is crucial that painted parts are given enough time to dry before assembly. We capture such temporal resources using a time-graded variant of Fitch-style modal type systems, develop a corresponding modally typed, effectful core calculus, and equip it with a graded-monadic denotational semantics illustrated by a concrete presheaf model. Our calculus also includes temporally-aware graded algebraic effects and effect handlers. The former are given a novel temporal treatment, where operations' specifications include their execution times, and their continuations know that an operation's worth of additional time has passed before they start executing, making it possible to safely access further temporal resources in them, and where effect handlers have to respect this temporal discipline.
翻译:我们探索了安全使用资源的类型系统和编程抽象性。特别是,我们调查了如何使用类型来模块化地指定和检查程序何时允许使用其资源,例如,在生产线上编程机器人臂时,必须给油漆部件足够的时间在组装前干燥。我们利用惠誉式模式型系统的时间级变体来捕捉这种时间资源,开发一个相应的模式式、效果式核心微积分,并用混凝土前沙夫模型来显示的分级-单调语义。我们的微积分还包含时间觉分级代数效果和效果处理器。前者得到了新的时间处理,其中操作的规格包括执行时间,其持续时间知道在开始执行之前一项价值额外的操作已经过去,从而有可能安全地获得它们中更多的时间资源,而且操作者必须尊重这一时间纪律。