diff --git a/dag/gunbc/recurring_failure_mode/first_element_of_a_list_has_three_spellings.dag b/dag/gunbc/recurring_failure_mode/first_element_of_a_list_has_three_spellings.dag new file mode 100644 index 00000000000..ba4ce6215a4 --- /dev/null +++ b/dag/gunbc/recurring_failure_mode/first_element_of_a_list_has_three_spellings.dag @@ -0,0 +1,21 @@ +module gunbc.recurring_failure_mode.first_element_of_a_list_has_three_spellings + +import std.types { NonEmptyStr } +import std.decl_ref { DeclarationRef, WholeDeclaration } +import gunbc.recurring_failure_mode { RecurringFailureMode } + +data first_element_of_a_list_has_three_spellings: RecurringFailureMode = RecurringFailureMode { + identity: "first_element_of_a_list_has_three_spellings" as NonEmptyStr, + receipts: [ + "INVALID STATE: one operation -- the first element of a list, or its absence -- has three spellings (a DESIGN section 3 nickname fork). (1) The std.algebra free_monoid_collection_templates roster row first (ReceiverSelf -> OptionalOf), which has no declaration, so a bare first(xs) is unbound on the v2 native route (found on N7's route at v2.compiler.dependency_demand_census demand_fact_head_is_lexical and demand_fact_head_is_parameter). (2) v2.std.algebra list_head, the most widely called of the three (its callers are re-derived by a word-grep for list_head over dag and src/v2), returning its OWN carrier ListHeadResult = HeadFound | HeadAbsent. (3) v2.std.collection list_at_optional(xs, 0). The roster siblings last and get carry the same shape of fork beside their own declared spellings.", + "SECOND FORK INSIDE THE FIRST: ListHeadResult is an Optional-shaped carrier -- a fourth spelling of Optional beside the generic v2.std.optional Optional -- so it is ALSO in the scope of bright-fox-661's Optional de-fork (one Optional authority on both routes), which should retire it onto that authority rather than this row restating its own.", + "HARM: callers pick a spelling per site, so one fact is answered three ways with two result carriers, and the undeclared roster spelling refuses on the native route. RUNG FOUND AT: mitigatable (the unbound name refuses loudly). CEILING: structurally impossible -- one typing authority per collection op. OWNER: the XL-2 roster lane (lively-crane-656); the roster binding is stern-swift-290's roster route. NEXT-RUNG TRIGGER, NAMING THE CAPABILITY: collection roster ops are the single typing authority for first/last/get, their result type the one Optional authority, with list_head and list_at_optional retired onto them delete-first (per calm-boar-904's ruling that the roster row is the single authority for collection ops), SUFFICIENT FOR no module to spell first-element, last-element or index access any other way.", + ], + evidence: [ + DeclarationRef { module_path: "std.algebra", decl_name: "free_monoid_collection_templates", field: WholeDeclaration }, + DeclarationRef { module_path: "v2.std.algebra", decl_name: "list_head", field: WholeDeclaration }, + DeclarationRef { module_path: "v2.std.algebra", decl_name: "ListHeadResult", field: WholeDeclaration }, + DeclarationRef { module_path: "v2.std.collection", decl_name: "list_at_optional", field: WholeDeclaration }, + DeclarationRef { module_path: "v2.std.optional", decl_name: "Optional", field: WholeDeclaration }, + ], +}