xpile 0.1.616

Polyglot transpile workbench (Python/C/C++/Rust/Ruchy/Lean ↔ Rust/Ruchy/PTX/WGSL/SPIR-V) with provable contracts at every layer.
1
2
3
4
5
6
7
# PMAT-1168: an Optional field WITH a format spec is refused. Python's
# format(None, ">5") is itself a TypeError, so there is no single correct static
# rendering (present -> the value formatted, absent -> a runtime error). Reject
# cleanly rather than emit uncompilable Rust or a silent divergence. The plain
# f"{d.get(k)}" (no spec) renders fine — see fstring_dict_get_optional.py.
def f(d: dict[str, int], k: str) -> str:
    return f"val={d.get(k):>5}"