架构优化

This commit is contained in:
2026-08-11 12:40:28 +08:00
parent e91f134f16
commit 8d4714f691
17 changed files with 210 additions and 107 deletions
+7 -2
View File
@@ -100,8 +100,11 @@ static_assert(Property::writable);
static_assert(Property::runtime_copy_writable);
using Value = Property::value_type;
using Accessor = Property::accessor_type;
using Dependencies = Property::dependency_spec;
```
Every custom `Property_Accessor` must declare `using dependency_spec = ...`. Use `No_Property_Dependencies` when it has no dependencies; there is no implicit fallback.
A `read_only` field reports:
```cpp
@@ -513,7 +516,7 @@ computed_property<Device, int>(depends_on<&Device::min_speed, &Device::max_speed
}, key<"speed_span">)
```
`depends_on<...>` makes dependencies explicit Schema facts. `depends_on_keys<"a", "b">` is available when key-based declaration is more appropriate. A computed view can read only its declared direct dependencies.
`depends_on<...>` makes dependencies explicit Schema facts. `depends_on_keys<"a", "b">` is available when key-based declaration is more appropriate. `depends_on<>` is a valid explicit zero-dependency declaration. A computed view can read only its declared direct dependencies.
Writable dependencies that must form one snapshot should share a synchronization domain with each other:
@@ -526,7 +529,9 @@ synchronization(
Do not put the computed property itself in a synchronization rule. Its read slot is derived from the dependency graph; a schema or per-instance topology is rejected when synchronized dependencies do not resolve to one domain. Read-only stored dependencies need no lock slot.
`schema_property_dependency_indices<Schema, Index>()` exposes the direct dependency indices for schema consumers.
`schema_property_dependency_indices<Schema, Index>()` exposes the direct dependency indices for schema consumers. `schema_dependency_graph_acyclic<Schema>()` exposes the DAG invariant; `object_schema(...)` rejects cyclic dependency graphs at compile time.
A descriptor stores Attributes and Constraints in one metadata tuple. `for_each_metadata()` traverses both kinds, `for_each_attribute()` traverses only Attributes, and `for_each_constraint()` traverses only Constraints.
## 21. Trusted accessor properties