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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
//! The mark store: [`Scholion`] and [`Scholia`] (PRD 0021, stage D of the
//! structured document horizon).
//!
//! A *scholion* is one mark over a sequence: a span said in identities (two
//! sided [`Verge`] boundaries) carrying a caller-opaque tag. *Scholia* is
//! the store of them: dot-tagged marks under the survivor law, the
//! annotation instance of the open [`DotStore`](crate::metis::DotStore)
//! axis. The names are the classical ones and the division of labor rides
//! in them: scholia are the marginal annotations keyed to spans of a text,
//! living beside it without altering it, their interpretive content held
//! elsewhere (the commentary). So here: the store carries *where* a mark
//! sits (identity boundaries) and *what the caller said* (the opaque tag);
//! what a tag means, which tags nest, and how marks render stay the
//! caller's forever (ruling R-23 redraws the rich-text-schema refusal at
//! exactly this line: mark mechanics in, mark semantics out).
//!
//! The hazard this closes by construction is positional drift: a
//! position-anchored span ends up decorating the wrong words after
//! concurrent inserts, while an identity-anchored span cannot move,
//! because a dot never moves and a deleted element still holds its order
//! slot as a tombstone. The projection onto the current document order,
//! with its honest verdicts (covered, empty, inverted, dangling), is the
//! sequence's own read: [`Rhapsody::extent`](crate::metis::Rhapsody::extent).
//!
//! # The recipes
//!
//! A `Scholia<T>` behaves exactly like the payload store it carries
//! (`DotFun<Scholion<T>>`): the merge is the survivor law with content
//! following the dot, so every register recipe applies verbatim.
//!
//! * *Mint a shared mark*: `composer.compose(|dot| (Scholia::singleton(dot,
//! scholion), DotSet::new()))`; the mark converges everywhere the delta
//! reaches, and concurrent marks are siblings (all readable, none
//! chosen).
//! * *Edit a mark* (move an end, restyle a tag): a register supersede, one
//! covered delta re-minting the whole scholion over the old dot
//! ([`Composer::compose_super`](crate::metis::Composer::compose_super)
//! with the superseded set naming the old dot). Ends stay immutable per
//! dot, so a half-moved span is unrepresentable.
//! * *Remove a mark*: `composer.retract` of the mark's dot. A concurrent
//! edit of the same mark survives as its own dot (observed-remove, the
//! axis's standing semantics).
//! * *Per-participant marks* (cursors, selections): key by participant,
//! `DotMap<Participant, Scholia<T>>`, the cursor-register recipe with a
//! span payload.
extern crate alloc;
use Verge;
use ;
/// One mark: a span said in identities, carrying a caller-opaque tag.
///
/// The two [`Verge`] ends fix the span's boundaries in the sequence's
/// identity space, sides chosen at mint (the expansion rule: see the
/// [`Verge`] and [`extent`](crate::metis::Rhapsody::extent) docs). The tag
/// is whatever the caller's mark model needs (a style token, a comment id,
/// a proposal reference); minerva never reads it, compares it only for
/// value equality, and attaches no meaning to it.
///
/// A scholion is immutable under its dot (content follows the dot, axis
/// law 3): editing a mark is a register supersede that re-mints the whole
/// scholion, so its `start`, `end`, and `tag` always changed together or
/// not at all.
/// The mark store: dot-tagged [`Scholion`]s under the survivor law, the
/// annotation instance of the open [`DotStore`](crate::metis::DotStore)
/// axis (PRD 0021).
///
/// Structurally this is the payload store applied to spans
/// (`DotFun<Scholion<T>>`), and its merge semantics are exactly that store's:
/// no new merge law, no policy, concurrent marks and concurrent edits of one
/// mark surface as siblings. The named type adds two things: the mark
/// vocabulary itself, and the anchor read
/// ([`anchor_dots`](Self::anchor_dots)). The anchor read is the set of
/// sequence dots the live marks are pinned to. A retention policy must treat
/// that set as load-bearing. A `condense` that excises a tombstone a mark
/// anchors leaves that mark [`Dangling`](crate::metis::Extent::Dangling). The
/// verdict is honest, and the pinning policy is the caller's (PRD 0021 R5).
// Manual, as on the payload store itself: bottom needs no `T: Default`.