Multi-stage programming with functors and monads: eliminating abstraction overhead from generic code

Multi-stage programming with functors and monads: eliminating abstraction overhead from generic code
复制标题

使用仿函数和单子的多阶段编程:消除通用代码的抽象开销

DOI:
10.1007/11561347_18
复制
发表时间:
2005
期刊:
--
影响因子:
--
通讯作者:
O. Kiselyov
O. Kiselyov
中科院分区:
--
文献类型:
--
作者:
J. Carette;O. Kiselyov

文献摘要

参考文献

被引文献

相似文献

以高斯消去法作为数值和符号算法的代表性家族,我们使用多阶段编程、单子和Ocaml的高级模块系统来演示完全消除抽象开销,同时避免对生成的代码进行任何检查。我们在很大程度上参数化了高斯消去代码(在域上,矩阵表示,行列式跟踪,旋转策略,结果类型等),而不需要运行时成本。因为生成的结果代码是正确的,之后不会更改,所以我们享受MetaOCaml对生成的代码类型良好的保证。我们进一步证明了各种抽象参数(方面)可以是正交的和组合的,即使存在临时名称生成和其他绑定以及方面的“交错”。我们还展示了如何编码一些特定于领域的知识,以便在处理生成器而不是生成的代码时,编译器可以静态地拒绝“明显错误”的组合。
With Gaussian Elimination as a representative family of numerical and symbolic algorithms, we use multi-stage programming, monads and Ocaml’s advanced module system to demonstrate the complete elimination of the abstraction overhead while avoiding any inspection of the generated code. We parameterize our Gaussian Elimination code to a great extent (over domain, matrix representations, determinant tracking, pivoting policies, result types, etc) at no run-time cost. Because the resulting code is generated just right and not changed afterwards, we enjoy MetaOCaml’s guaranty that the generated code is well-typed. We further demonstrate that various abstraction parameters (aspects) can be made orthogonal and compositional, even in the presence of name-generation for temporaries and other bindings and “interleaving” of aspects. We also show how to encode some domain-specific knowledge so that “clearly wrong” compositions can be statically rejected by the compiler when processing the generator rather than the generated code.
DOI: 10.1007/bfb0035455
发表时间: 1994
期刊: --
影响因子: --
作者:
J. Henry;J. Yvon
通讯作者: J. Henry;J. Yvon
DOI: 10.1007/bfb0053381
发表时间: 1997-01-01
期刊: ECOOP'97: OBJECT-ORIENTED PROGRAMMING
影响因子: --
作者:
Kiczales, G;Lamping, J;Irwin, J
通讯作者: Irwin, J