feat(lang): ports - port Clock { ... } in a module, bind Clock { ... } in the app
A port is a record of function values a module calls through (Clock.now()) without naming the module that answers. A port used and never bound, a bind missing a required member or naming one the port lacks, and a second bind are refused; the binder must see the port, and what it binds is checked from its own file. Reseed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
d0ad364ad4
commit
b1ccaf08bd
19 changed files with 50439 additions and 47750 deletions
|
|
@ -21,6 +21,7 @@ function selfhost_frags() -> []pointer {
|
|||
push(f, "selfhost/frontend/generics.ludic")
|
||||
push(f, "selfhost/frontend/aliases.ludic")
|
||||
push(f, "selfhost/frontend/modules.ludic")
|
||||
push(f, "selfhost/frontend/ports.ludic")
|
||||
push(f, "selfhost/frontend/registry.ludic")
|
||||
push(f, "selfhost/frontend/registry_finish.ludic")
|
||||
push(f, "selfhost/frontend/resource.ludic")
|
||||
|
|
|
|||
|
|
@ -740,6 +740,11 @@ function cmd_dev_test() -> int {
|
|||
reject_case("rejected/uses_cycle", "go round in a circle: a -> b -> a", "a cycle in the declared uses is refused")
|
||||
feat_case("modules/friend_of", "", "7 7", "friend_of.ludic (L3: `friend module lab of bank` sees bank's private names)")
|
||||
reject_case("rejected/friend_scope", "add is private to module bank", "a friend of one module is not a friend of another")
|
||||
feat_case("modules/ports", "", "30 5", "ports.ludic (L3: `port Clock { ... }` in a module, `bind Clock { ... }` in the app, calls through Clock.now())")
|
||||
reject_case("rejected/port_unbound", "port Clock is used here but never bound", "a port used and never bound is refused at the use")
|
||||
reject_case("rejected/port_missing", "bind Clock leaves out day, which has no default", "a bind gives every required member")
|
||||
reject_case("rejected/port_twice", "port Clock is bound twice (first at", "a port is bound once")
|
||||
reject_case("rejected/port_private", "Clock is private to module clock", "whoever binds a port has to see it")
|
||||
vis_report_case("rejected/uses_missing", "uses: examples/rejected/uses_valley/items/index.ludic:3: items.inv_add used from", "LUDIC_VIS_REPORT=1 lists a uses violation and builds")
|
||||
feat_case("lang/checked", "", "7.5 3 12 hi 2 ok", "checked.ludic (L4: literals take their slot's kind, string(p), []string as []pointer, null, named args)")
|
||||
reject_case("rejected/wrong_arity", "this call to area leaves out h, which has no default", "a call with the wrong number of arguments is refused")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue