hclang 0.49.0 → 0.50.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -74,14 +74,13 @@ export function denumClass() {
|
|
|
74
74
|
}
|
|
75
75
|
/**
|
|
76
76
|
* Constructs a Denum of any arity with the HC class: `Denum [count, loads]`.
|
|
77
|
-
*
|
|
78
|
-
* right]` builds; any other nonzero number gives the channel Denum (007.27).
|
|
77
|
+
* Every number of loads, one or more, is the same class (007.27, 007.40).
|
|
79
78
|
*
|
|
80
79
|
* @param count The full application Count.
|
|
81
80
|
* @param loads The ordered channel loads.
|
|
82
81
|
* @returns The new instance, or the class's failure.
|
|
83
82
|
*/
|
|
84
|
-
export function
|
|
83
|
+
export function constructDenum(count, loads) {
|
|
85
84
|
const constructor = denumClass();
|
|
86
85
|
if (constructor.isFailedResult() || constructor.observationError()) {
|
|
87
86
|
return constructor;
|
|
@@ -89,15 +88,4 @@ export function constructDenumLoads(count, loads) {
|
|
|
89
88
|
const state = new FrameArray([count, new FrameArray([...loads])]);
|
|
90
89
|
return FrameExpr.answeredValue(constructor.call(state)).referent();
|
|
91
90
|
}
|
|
92
|
-
|
|
93
|
-
* Constructs a binary Denum with the HC class: `Denum [count, left, right]`.
|
|
94
|
-
*
|
|
95
|
-
* @param count The full application Count; the Denum derives its phase from it.
|
|
96
|
-
* @param left The left load.
|
|
97
|
-
* @param right The right load.
|
|
98
|
-
* @returns The new instance, or the class's failure.
|
|
99
|
-
*/
|
|
100
|
-
export function constructDenum(count, left, right) {
|
|
101
|
-
return constructDenumLoads(count, [left, right]);
|
|
102
|
-
}
|
|
103
|
-
installDenumConstructor(constructDenumLoads);
|
|
91
|
+
installDenumConstructor(constructDenum);
|
|
@@ -25,14 +25,13 @@ export const ROUTER_SOURCE = "hc/rotor-router.hc";
|
|
|
25
25
|
/** The name the file declares the constructor under. */
|
|
26
26
|
export const ROUTER_CLASS = "RotorRouter";
|
|
27
27
|
/**
|
|
28
|
-
* The
|
|
29
|
-
* instance from channels already known to be
|
|
30
|
-
* or copying them
|
|
31
|
-
* other number.
|
|
28
|
+
* The builder the class file declares beside its constructor, which makes an
|
|
29
|
+
* instance of any number of channels from channels already known to be
|
|
30
|
+
* admissible, without validating or copying them.
|
|
32
31
|
*/
|
|
33
|
-
export const
|
|
32
|
+
export const ROUTER_BUILDER = "router-instance";
|
|
34
33
|
let loaded;
|
|
35
|
-
let
|
|
34
|
+
let builder;
|
|
36
35
|
let loading = false;
|
|
37
36
|
/**
|
|
38
37
|
* Evaluates class source in a namespace of its own, answering its
|
|
@@ -53,11 +52,11 @@ export function loadRouterClass(source) {
|
|
|
53
52
|
if (constructor.is.missing) {
|
|
54
53
|
return Frame.error(`$!.router-prologue-missing ${ROUTER_CLASS}`);
|
|
55
54
|
}
|
|
56
|
-
const
|
|
57
|
-
if (
|
|
58
|
-
return Frame.error(`$!.router-prologue-missing ${
|
|
55
|
+
const instance = namespace.getOwn(ROUTER_BUILDER);
|
|
56
|
+
if (instance.is.missing) {
|
|
57
|
+
return Frame.error(`$!.router-prologue-missing ${ROUTER_BUILDER}`);
|
|
59
58
|
}
|
|
60
|
-
|
|
59
|
+
builder = instance;
|
|
61
60
|
return constructor;
|
|
62
61
|
}
|
|
63
62
|
/**
|
|
@@ -94,8 +93,8 @@ export function constructRouter(channels) {
|
|
|
94
93
|
return FrameExpr.answeredValue(constructor.call(channels)).referent();
|
|
95
94
|
}
|
|
96
95
|
/**
|
|
97
|
-
* The channels of an instance of the shipped class
|
|
98
|
-
*
|
|
96
|
+
* The channels of an instance of the shipped class, for `.####` (007.27);
|
|
97
|
+
* undefined for anything else.
|
|
99
98
|
*
|
|
100
99
|
* Recognition mirrors the Denum's (007.25e): the source's own stored
|
|
101
100
|
* `channels`, a list of arrays, must rebuild through the constructor into a
|
|
@@ -113,7 +112,7 @@ export function channelRouterChannels(source) {
|
|
|
113
112
|
if (!(stored instanceof FrameArray))
|
|
114
113
|
return undefined;
|
|
115
114
|
const channels = stored.elements().map((channel) => channel.referent());
|
|
116
|
-
if (channels.length === 0
|
|
115
|
+
if (channels.length === 0)
|
|
117
116
|
return undefined;
|
|
118
117
|
if (!channels.every((channel) => channel instanceof FrameArray)) {
|
|
119
118
|
return undefined;
|
|
@@ -142,12 +141,9 @@ export function dealtRouter(channels) {
|
|
|
142
141
|
if (constructor.isFailedResult() || constructor.observationError()) {
|
|
143
142
|
return constructor;
|
|
144
143
|
}
|
|
145
|
-
if (!
|
|
144
|
+
if (!builder)
|
|
146
145
|
return Frame.error("$!.router-unavailable /");
|
|
147
|
-
|
|
148
|
-
? builders.binary
|
|
149
|
-
: builders.channel;
|
|
150
|
-
return FrameExpr.answeredValue(build.call(channels)).referent();
|
|
146
|
+
return FrameExpr.answeredValue(builder.call(channels)).referent();
|
|
151
147
|
}
|
|
152
148
|
installDivisionCarrier(dealtRouter);
|
|
153
149
|
installRouterRecognizer(channelRouterChannels);
|
|
@@ -50,7 +50,7 @@ function storedLoads(source) {
|
|
|
50
50
|
}
|
|
51
51
|
/**
|
|
52
52
|
* The intrinsic Denum path (007.25e). A constructed Denum is the one Frame whose
|
|
53
|
-
* fourth hash the three observers cannot decide: `Denum [0, 0, 0]` reads 0, 0,
|
|
53
|
+
* fourth hash the three observers cannot decide: `Denum [0, [0, 0]]` reads 0, 0,
|
|
54
54
|
* 0, exactly as `[]` does, yet it is a present state. Rather than let any
|
|
55
55
|
* class declare its own `.####`, the fourth hash recognizes an instance of the
|
|
56
56
|
* shipped class itself, and nothing else.
|
|
@@ -148,17 +148,14 @@ export function bindDenumCount(source) {
|
|
|
148
148
|
return construct(new FrameCount(state.count), bound.map((load) => new FrameCount(load)));
|
|
149
149
|
}
|
|
150
150
|
/**
|
|
151
|
-
* The
|
|
152
|
-
*
|
|
153
|
-
*
|
|
154
|
-
*
|
|
155
|
-
*
|
|
156
|
-
* `Denum [C, [load0, …]]`, where a load is the summed Size of a channel's
|
|
157
|
-
* children and an empty channel's load is 0. The binary router keeps the
|
|
158
|
-
* derived path, which already answers `Denum(C, L, R)`.
|
|
151
|
+
* The router path (007.27). A router of k channels routes to channel C mod k,
|
|
152
|
+
* which only a Denum of k loads follows, so an instance of the shipped
|
|
153
|
+
* `RotorRouter` class, of any number of channels, answers the Denum of its
|
|
154
|
+
* Count and channel loads, `Denum [C, [load0, …]]`, where a load is the summed
|
|
155
|
+
* Size of a channel's children and an empty channel's load is 0.
|
|
159
156
|
*
|
|
160
157
|
* Its Count is the children it holds; at Count zero it has no Denum, as the
|
|
161
|
-
* empty
|
|
158
|
+
* empty host has none. Each child's Size is read
|
|
162
159
|
* once, and a failed Size is answered as it is.
|
|
163
160
|
*
|
|
164
161
|
* @param source The observed Frame.
|
|
@@ -199,7 +196,7 @@ function channelRouterDenum(source) {
|
|
|
199
196
|
* caches the source, and reads each observer at most once.
|
|
200
197
|
*
|
|
201
198
|
* A derived source with Count zero is nil: a host with no children has no
|
|
202
|
-
* Denum, so `[].####` and `0.####` are nil while `(Denum [0, 0, 0]).####` is
|
|
199
|
+
* Denum, so `[].####` and `0.####` are nil while `(Denum [0, [0, 0]]).####` is
|
|
203
200
|
* present. No class can declare `.####` for itself; only the three observers
|
|
204
201
|
* are declarable (`FrameArray.OBSERVATION_KEYS`).
|
|
205
202
|
*
|
package/esm/lib/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = "0.
|
|
1
|
+
export const VERSION = "0.50.0";
|