1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
// Copyright 2024-2026 Jonathan Shook
// SPDX-License-Identifier: Apache-2.0
//! Binding a child kernel under a parent, on any engine
//! (native_scope_trees.md §5).
//!
//! A scope tree is built by binding each child under its parent: the
//! parent's cells attached, its values copied in, the child's scope-init
//! constants materialized. The wiring is over `dyn Kernel` on both sides,
//! so a child of any engine binds under a parent of any engine, and a
//! parent shared across threads may have children bound under it from
//! several at once (`Kernel: Sync`).
use Arc;
use crateValue;
use crate;
/// A kernel of `program` bound under `parent`: `iter_bindings` written
/// first, so the child's own scope coordinates see them, then the
/// parent's cells attached and its values copied in.
///
/// What the child holds when this returns is what its scope knows at
/// construction. A parent `const`, and anything else fixed when the
/// parent was initialized, is in the child's input of the same name,
/// by value, and [`Kernel::input_value`] reads it. A value the parent
/// computes per cycle is attached as a cell and holds nothing until
/// the parent computes it. So a child that needs a fact at
/// construction declares an `extern` for the constant, not for a
/// per-cycle value made from it ([host questions guide], and
/// scope_model.md §4 for the rule form by form).
///
/// [host questions guide]: https://github.com/nosqlbench/polydat/blob/main/crates/polydat/docs/guides/host_questions.md
///
/// The kernel's [`Kernel::program_id`] is `program`'s, whichever engine
/// `program` is on, so a host that sealed a plan of indices against the
/// program can use it on every kernel bound from it.
/// Copy `parent`'s input values into `child`'s inputs of the same name:
/// what carries a cascade of externs down a scope tree past what the
/// child imports as outputs.
///
/// Coordinates are not copied; a host positions a child with
/// `set_inputs`. An input with no value on the parent is skipped. A
/// value the child's declared input refuses is an error naming both,
/// not a skip (input_variance.md §7).