Show HN: Sigil – 在类型级别追踪数据信任

1作者: croolily6 个月前
Sigil 是一种编程语言,其类型系统会追踪数据的来源。<p><pre><code> 外部数据被标记为 `~`(已报告)。经过验证的数据变为 `?`(不确定)。 计算值是 `!`(已知)。类型检查器强制执行这些边界—— 未经显式验证,已报告的数据无法满足已知需求。 fn process(input~: str) -&gt; Result! { let validated? = input |validate!{ parse_int(_) } let result! = validated * 2 &#x2F;&#x2F; OK: 计算产生已知值 result } 这在编译时捕获注入漏洞,并在函数签名中明确信任边界。 其他特性: - 用于管道的词素运算符:`data |τ{_ * 2} |φ{_ &gt; 10} |Σ` - 类似 Rust 的所有权和借用 - 自托管编译器(233/233 个测试通过) - 解释器、JIT 和 LLVM 后端 使用 Rust 编写。MIT/Apache-2.0 许可。 https://github.com/Daemoniorum-LLC/sigil-lang</code></pre>
查看原文
Sigil is a programming language where the type system tracks data provenance.<p><pre><code> External data is marked `~` (reported). Validated data becomes `?` (uncertain). Computed values are `!` (known). The type checker enforces these boundaries - reported data can&#x27;t satisfy a known requirement without explicit validation. fn process(input~: str) -&gt; Result! { let validated? = input |validate!{ parse_int(_) } let result! = validated * 2 &#x2F;&#x2F; OK: computation produces known result } This catches injection vulnerabilities at compile time and makes trust boundaries explicit in function signatures. Other features: - Morpheme operators for pipelines: `data |τ{_ * 2} |φ{_ &gt; 10} |Σ` - Rust-like ownership and borrowing - Self-hosting compiler (233&#x2F;233 tests passing) - Interpreter, JIT, and LLVM backends Written in Rust. MIT&#x2F;Apache-2.0. https:&#x2F;&#x2F;github.com&#x2F;Daemoniorum-LLC&#x2F;sigil-lang</code></pre>