Lobsters | 📄 原文链接 | 2026-10-25 收录

增量计算图:Salsa 式红绿标记怎么让重编译变即时

来源:dziban.net — 2026-10

📋 概述

作者在给 Yabu 做交互式重编译、代码生成与类型检查时,照着 Salsa 实现了一套增量计算图。图里只有两种节点:可变的输入,和纯函数形式的计算,计算被 memoize,靠"红绿标记"在输入变化时精确失效。每条 memo 都记着返回值、最后确认有效的版本、最后变更的版本与依赖列表,于是改一个函数签名只会重算受影响的那一小块。

🔑 核心要点

💡 金句

Now if f_1 changes type signature, automatically the typecheck of this function will get invalidated! This invalidation is key to make the Yabu typechecker very fast for interactive use even in large programs.
← 返回 Lobsters 首页