Deconstraining DSLs

Deconstraining DSLs
复制标题

解除 DSL 的约束

DOI:
--
复制
发表时间:
2012
期刊:
ACM SIGPLAN International Conference on Functional Programming
影响因子:
--
通讯作者:
T. O. R. Allwood
T. O. R. Allwood
中科院分区:
--
文献类型:
--
作者:
W. Jones;T. Field;T. O. R. Allwood

文献摘要

被引文献

相似文献

强类型函数式语言为嵌入领域特定语言 (DSL) 提供了强大的框架。然而,构建通过嵌入式 DSL 定义的类型安全函数可能会引入特定于应用程序的类型约束,这些约束最终会强加在 DSL 数据类型本身上。在最好的情况下,这些约束是难以处理的,在最坏的情况下,它们会限制可以构建的 DSL 表达式的范围。我们针对这个问题提出了一个简单的解决方案,允许在使用 DSL 表达式时指定特定于应用程序的约束,而不是在定义 DSL 的嵌入类型时指定。我们的解决方案同样适用于标记和无标记表示,重要的是,也适用于更高级别的类型。
Strongly-typed functional languages provide a powerful framework for embedding Domain-Specific Languages (DSLs). However, building type-safe functions defined over an embedded DSL can introduce application-specific type constraints that end up being imposed on the DSL data types themselves. At best, these constraints are unwieldy and at worst they can limit the range of DSL expressions that can be built. We present a simple solution to this problem that allows application-specific constraints to be specified at the point of use of a DSL expression rather than when the DSL's embedding types are defined. Our solution applies equally to both tagged and tagless representations and, importantly, also works in the presence of higher-rank types.