一句话:提出一种嵌入式动画幻灯片 DSL,统一深浅嵌入,支持自定义动画组合子并检视、调整和重组动画。
本文为幻灯片演示中的动画设计了一种嵌入式领域特定语言(DSL)。该 DSL 程序以两种方式与宿主语言交互:一方面允许用宿主语言函数构建图片和动画,类似浅嵌入;另一方面允许宿主语言反射其构造过程,类似深嵌入。因此,用户既能定义自己的动画组合子,又能检视、调整和重组已有的动画。为展示表达力,作者实现了类似 Keynote 的 Magic Move 操作。论文进一步总结了深浅 DSL 设计的经验:深嵌入与浅嵌入并非互斥,而是同一设计谱系上的不同点;位于两者之间的设计点往往能充分发挥 DSL 的潜力。
Another DSL for pictures? Seems fishy. But hold fast as we chart a course to an embedded DSL for the domain of slide presentations with animations. Our DSL programs interact with the host language in two ways: by allowing pictures and animations to be built using host-language functions (resembling a shallow embedding), and by allowing host-language reflection on their construction (resembling a deep embedding). As a result, users can define their own animation combinators but still also inspect, adjust, and reassemble animations. To demonstrate our DSL's expressive power, we show how it supports a Keynote-like Magic Move operation. Having made the DSL shipshape, we dive into a lesson learned about deep and shallow DSL design. While deep and shallow may seem like mutually exclusive options, we argue they are actually points on an entire spectrum of possible DSL designs. More importantly, our paper demonstrates that points on the spectrum between deep and shallow are where DSL designs achieve full sail.
@article{FlattFF26,
title = {Animated Pictures for Slide Presentations: From the Shallows to the Depths of a Domain-Specific Language (Functional Pearl)},
author = {Oliver Flatt and Robert Bruce Findler and Matthew Flatt},
journal = {Proceedings of the ACM on Programming Languages},
volume = {10},
number = {ICFP},
year = {2026},
doi = {10.1145/3828692}
}