Prose: render param-in restrictions and (kernel) marker (prep.3 holes) #35
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The prose printer (
crates/ailang-prose/src/lib.rs) silently dropstwo fields introduced by the kernel-extension-mechanics milestone
(prep.3, #33):
TypeDef.param_in—write_type_defdoes not inspect the map;the closed-set restriction
(param-in (a Int Float))disappearson render.
Module.kernel—write_moduledoes not inspect the flag; a(kernel)module is indistinguishable from a normal one in prose.Both are semantically load-bearing (the difference between
NumBox<Int>accepted andNumBox<Str>rejected is exactly theparam_inmap; auto-import behaviour depends onkernel), so thisgoes beyond the "prose-is-lossy by design" carve-out for
(con T)wrappings and parenthesis elision.
Proposed projection —
param-in:Inline on the type-var list, analogous to
forall<a> where Num a:Multiple restrictions:
The restriction sits at the point where the variable is introduced,
which keeps the
dataline readable as a single declaration.Proposed projection —
(kernel):Marker comment on the line below
// module …, analogous to// @suppress:// @kernelreuses the existing// @<attr>convention (currentlyonly
@suppress) instead of introducing a new top-level keyword.Open question for the brainstorm:
(term-ctor T Ctor args)currently renders asCtor(args)(thetype name is dropped — recoverable from typecheck context). With
param-inin scope, the type identity at the constructor site isload-bearing for the LLM reader (to local-check the restriction).
Worth empirically testing whether the LLM-mediated roundtrip
recovers
(term-ctor NumBox MkNumBox 17)correctly fromMkNumBox(17), or whether prose should renderNumBox::MkNumBox(17)when the ctor's type carries a
param-inmap.Form-A is unchanged. Canonical and hashable artefacts move
nothing. Only the prose projection changes.
Scope:
crates/ailang-prose/src/lib.rs— extendwrite_type_def(
param-inrendering) andwrite_module(@kernelmarker)examples/exercising both fields(likely a minimal
numbox_demo.ailforparam-inand are-projection of
kernel_stubfor@kernel)docs/PROSE_ROUNDTRIP.md— document the two new projectionsRefs #33.