Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion src/v3/std/emit_model.dag
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,19 @@ type PlaceholderConvention
= IndexedArgs
| NamedArg

// Emit-side template shape for a method render contract. Ordinary methods have
// a single target expression template; higher-order methods need separate
// inline-lambda and function-reference templates, plus the Rust sharing wrapper
// fact. The sum keeps those states explicit instead of admitting optional-field
// combinations that do not correspond to a real render mode.
type MethodEmitTemplate
= SingleTemplate { template: String }

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BLOCKING: MethodEmitTemplate is a new substrate coproduct with two variants, but its receipt never classifies it 🟢/🟡/🔴 or gives the required ledger/trigger under the coproduct-dissolution discipline.

| HigherOrderTemplates {
inline_template: String
fn_ref_template: String
wraps_in_sharing: Bool
}

// Per-target, per-method template contract. Sibling carrier to §6a
// `MethodContract` in `src/v3/std/algebra.dag` — that one carries
// target-agnostic cost/complexity metadata keyed by
Expand Down Expand Up @@ -378,7 +391,7 @@ type PlaceholderConvention
type MethodTemplateContract {
dag_method: MethodRef
runtime_template: String
emit_template: String
emit_template: MethodEmitTemplate
wraps_result: Bool
placeholder_convention: PlaceholderConvention
}
31 changes: 16 additions & 15 deletions src/v3/std/go_method_template_contracts.dag
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ module v3.std.go_method_template_contracts
import v3.std.emit_model {
MethodTemplateContract,
PlaceholderConvention,
NamedArg
NamedArg,
SingleTemplate
}
import v3.std.methods { MethodRef }
import std.methods {
Expand All @@ -62,98 +63,98 @@ data go_method_template_contracts: List<MethodTemplateContract> = [
{
dag_method: { decl: count_method },
runtime_template: "len({recv})",
emit_template: "len({recv})",
emit_template: SingleTemplate { template: "len({recv})" },
wraps_result: false,
placeholder_convention: NamedArg
},
{
dag_method: { decl: join_method },
runtime_template: "strings.Join({recv}, {arg})",
emit_template: "strings.Join({recv}, {arg})",
emit_template: SingleTemplate { template: "strings.Join({recv}, {arg})" },
wraps_result: false,
placeholder_convention: NamedArg
},
{
dag_method: { decl: split_method },
runtime_template: "strings.Split({recv}, {arg})",
emit_template: "strings.Split({recv}, {arg})",
emit_template: SingleTemplate { template: "strings.Split({recv}, {arg})" },
wraps_result: false,
placeholder_convention: NamedArg
},
{
dag_method: { decl: concat_method },
runtime_template: "append({recv}, {arg}...)",
emit_template: "append({recv}, {arg}...)",
emit_template: SingleTemplate { template: "append({recv}, {arg}...)" },
wraps_result: false,
placeholder_convention: NamedArg
},
{
dag_method: { decl: map_method },
runtime_template: "v2rt.Map({recv}, {arg})",
emit_template: "v2rt.Map({recv}, {arg})",
emit_template: SingleTemplate { template: "v2rt.Map({recv}, {arg})" },
wraps_result: false,
placeholder_convention: NamedArg
},
{
dag_method: { decl: filter_method },
runtime_template: "v2rt.Filter({recv}, {arg})",
emit_template: "v2rt.Filter({recv}, {arg})",
emit_template: SingleTemplate { template: "v2rt.Filter({recv}, {arg})" },
wraps_result: false,
placeholder_convention: NamedArg
},
{
dag_method: { decl: any_method },
runtime_template: "v2rt.Any({recv}, {arg})",
emit_template: "v2rt.Any({recv}, {arg})",
emit_template: SingleTemplate { template: "v2rt.Any({recv}, {arg})" },
wraps_result: false,
placeholder_convention: NamedArg
},
{
dag_method: { decl: all_method },
runtime_template: "v2rt.All({recv}, {arg})",
emit_template: "v2rt.All({recv}, {arg})",
emit_template: SingleTemplate { template: "v2rt.All({recv}, {arg})" },
wraps_result: false,
placeholder_convention: NamedArg
},
{
dag_method: { decl: flat_map_method },
runtime_template: "v2rt.FlatMap({recv}, {arg})",
emit_template: "v2rt.FlatMap({recv}, {arg})",
emit_template: SingleTemplate { template: "v2rt.FlatMap({recv}, {arg})" },
wraps_result: false,
placeholder_convention: NamedArg
},
{
dag_method: { decl: skip_method },
runtime_template: "{recv}[{arg}:]",
emit_template: "{recv}[{arg}:]",
emit_template: SingleTemplate { template: "{recv}[{arg}:]" },
wraps_result: false,
placeholder_convention: NamedArg
},
{
dag_method: { decl: take_method },
runtime_template: "{recv}[:{arg}]",
emit_template: "{recv}[:{arg}]",
emit_template: SingleTemplate { template: "{recv}[:{arg}]" },
wraps_result: false,
placeholder_convention: NamedArg
},
{
dag_method: { decl: fold_method },
runtime_template: "v2rt.Fold({recv}, {arg})",
emit_template: "v2rt.Fold({recv}, {arg})",
emit_template: SingleTemplate { template: "v2rt.Fold({recv}, {arg})" },
wraps_result: false,
placeholder_convention: NamedArg
},
{
dag_method: { decl: sort_by_method },
runtime_template: "v2rt.SortBy({recv}, {arg})",
emit_template: "v2rt.SortBy({recv}, {arg})",
emit_template: SingleTemplate { template: "v2rt.SortBy({recv}, {arg})" },
wraps_result: false,
placeholder_convention: NamedArg
},
{
dag_method: { decl: append_method },
runtime_template: "append({recv}, {arg})",
emit_template: "append({recv}, {arg})",
emit_template: SingleTemplate { template: "append({recv}, {arg})" },
wraps_result: false,
placeholder_convention: NamedArg
}
Expand Down
39 changes: 20 additions & 19 deletions src/v3/std/python_method_template_contracts.dag
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ module v3.std.python_method_template_contracts
import v3.std.emit_model {
MethodTemplateContract,
PlaceholderConvention,
NamedArg
NamedArg,
SingleTemplate
}
import v3.std.methods { MethodRef }
import std.methods {
Expand Down Expand Up @@ -58,126 +59,126 @@ data python_method_template_contracts: List<MethodTemplateContract> = [
{
dag_method: { decl: count_method },
runtime_template: "len({recv})",
emit_template: "len({recv})",
emit_template: SingleTemplate { template: "len({recv})" },
wraps_result: false,
placeholder_convention: NamedArg
},
{
dag_method: { decl: join_method },
runtime_template: "{arg}.join({recv})",
emit_template: "{arg}.join({recv})",
emit_template: SingleTemplate { template: "{arg}.join({recv})" },
wraps_result: false,
placeholder_convention: NamedArg
},
{
dag_method: { decl: split_method },
runtime_template: "{recv}.split({arg})",
emit_template: "{recv}.split({arg})",
emit_template: SingleTemplate { template: "{recv}.split({arg})" },
wraps_result: false,
placeholder_convention: NamedArg
},
{
dag_method: { decl: last_method },
runtime_template: "{recv}[-1] if {recv} else None",
emit_template: "{recv}[-1] if {recv} else None",
emit_template: SingleTemplate { template: "{recv}[-1] if {recv} else None" },
wraps_result: false,
placeholder_convention: NamedArg
},
{
dag_method: { decl: first_method },
runtime_template: "{recv}[0] if {recv} else None",
emit_template: "{recv}[0] if {recv} else None",
emit_template: SingleTemplate { template: "{recv}[0] if {recv} else None" },
wraps_result: false,
placeholder_convention: NamedArg
},
{
dag_method: { decl: enumerate_method },
runtime_template: "list(enumerate({recv}))",
emit_template: "list(enumerate({recv}))",
emit_template: SingleTemplate { template: "list(enumerate({recv}))" },
wraps_result: false,
placeholder_convention: NamedArg
},
{
dag_method: { decl: chars_method },
runtime_template: "[ord(c) for c in {recv}]",
emit_template: "[ord(c) for c in {recv}]",
emit_template: SingleTemplate { template: "[ord(c) for c in {recv}]" },
wraps_result: false,
placeholder_convention: NamedArg
},
{
dag_method: { decl: concat_method },
runtime_template: "{recv} + {arg}",
emit_template: "{recv} + {arg}",
emit_template: SingleTemplate { template: "{recv} + {arg}" },
wraps_result: false,
placeholder_convention: NamedArg
},
{
dag_method: { decl: map_method },
runtime_template: "[{arg}(x) for x in {recv}]",
emit_template: "[{arg}(x) for x in {recv}]",
emit_template: SingleTemplate { template: "[{arg}(x) for x in {recv}]" },
wraps_result: false,
placeholder_convention: NamedArg
},
{
dag_method: { decl: filter_method },
runtime_template: "[x for x in {recv} if {arg}(x)]",
emit_template: "[x for x in {recv} if {arg}(x)]",
emit_template: SingleTemplate { template: "[x for x in {recv} if {arg}(x)]" },
wraps_result: false,
placeholder_convention: NamedArg
},
{
dag_method: { decl: any_method },
runtime_template: "any({arg}(x) for x in {recv})",
emit_template: "any({arg}(x) for x in {recv})",
emit_template: SingleTemplate { template: "any({arg}(x) for x in {recv})" },
wraps_result: false,
placeholder_convention: NamedArg
},
{
dag_method: { decl: all_method },
runtime_template: "all({arg}(x) for x in {recv})",
emit_template: "all({arg}(x) for x in {recv})",
emit_template: SingleTemplate { template: "all({arg}(x) for x in {recv})" },
wraps_result: false,
placeholder_convention: NamedArg
},
{
dag_method: { decl: flat_map_method },
runtime_template: "[y for x in {recv} for y in {arg}(x)]",
emit_template: "[y for x in {recv} for y in {arg}(x)]",
emit_template: SingleTemplate { template: "[y for x in {recv} for y in {arg}(x)]" },
wraps_result: false,
placeholder_convention: NamedArg
},
{
dag_method: { decl: skip_method },
runtime_template: "{recv}[{arg}:]",
emit_template: "{recv}[{arg}:]",
emit_template: SingleTemplate { template: "{recv}[{arg}:]" },
wraps_result: false,
placeholder_convention: NamedArg
},
{
dag_method: { decl: take_method },
runtime_template: "{recv}[:{arg}]",
emit_template: "{recv}[:{arg}]",
emit_template: SingleTemplate { template: "{recv}[:{arg}]" },
wraps_result: false,
placeholder_convention: NamedArg
},
{
dag_method: { decl: fold_method },
runtime_template: "functools.reduce({arg}, {recv})",
emit_template: "functools.reduce({arg}, {recv})",
emit_template: SingleTemplate { template: "functools.reduce({arg}, {recv})" },
wraps_result: false,
placeholder_convention: NamedArg
},
{
dag_method: { decl: sort_by_method },
runtime_template: "sorted({recv}, key={arg})",
emit_template: "sorted({recv}, key={arg})",
emit_template: SingleTemplate { template: "sorted({recv}, key={arg})" },
wraps_result: false,
placeholder_convention: NamedArg
},
{
dag_method: { decl: append_method },
runtime_template: "{recv} + [{arg}]",
emit_template: "{recv} + [{arg}]",
emit_template: SingleTemplate { template: "{recv} + [{arg}]" },
wraps_result: false,
placeholder_convention: NamedArg
}
Expand Down
Loading