渐进式元编程
Gradual Metaprogramming
AI总结:
针对Python嵌入的动态类型DSL生成静态类型数据管道代码时存在的错误检测晚、定位难问题,提出渐进式元编程,通过代码片段类型检查与拼接时增量运行时检查实现迁移路径、早检测、准定位,并定义MetaGTLC演算及机械化证明其有效性。
摘要:
数据工程师越来越多地使用领域特定语言(DSLs)生成数据管道代码,这类DSL通常嵌入Python中。但调试数据管道生成过程存在挑战:Python DSL脚本中的错误往往在脚本执行后才被检测到,时机过晚,且触发错误的源代码位置难以定位。本文聚焦Python中嵌入的动态类型DSL生成静态类型数据管道描述代码的场景,提出渐进式元编程,旨在(1)提供向静态类型DSL迁移的路径;(2)更早检测代码生成类型错误;(3)报告类型错误对应的源代码位置。该方法通过类型检查代码片段并在拼接时增量执行运行时检查实现目标。我们定义了MetaGTLC——一种由渐进类型元语言操作静态类型对象语言的元编程演算,并通过转换为强制转换演算MetaCC赋予其语义,还在Agda中机械化证明了成功的元求值总能生成类型良好的对象程序。
英文摘要:
Data engineers increasingly use domain-specific languages (DSLs) to generate the code for data pipelines. Such DSLs are often embedded in Python. Unfortunately, there are challenges in debugging the generation of data pipelines: an error in a Python DSL script is often detected too late, after the execution of the script, and the source code location that triggers the error is hard to pinpoint. In this paper, we focus on the scenario where a DSL embedded in Python (so it is dynamically-typed) generates data pipeline description code that is statically-typed. We propose gradual metaprogramming to (1) provide a migration path toward statically typed DSLs, (2) immediately provide earlier detection of code generation type errors, and (3) report the source code location responsible for the type error. Gradual metaprogramming accomplishes this by type checking code fragments and incrementally performing runtime checks as they are spliced together. We define MetaGTLC, a metaprogramming calculus in which a gradually-typed metalanguage manipulates a statically-typed object language, and give semantics to it by translation to the cast calculus MetaCC. We prove that successful metaevaluation always generates a well-typed object program and mechanize the proof in Agda.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。