diff --git a/main.ts b/main.ts index 9acd0aa..12e40fb 100644 --- a/main.ts +++ b/main.ts @@ -12,6 +12,28 @@ import { import { Dictionary, IdentityMap, is, Record } from 'preserves'; import { Bag, ChangeDescription } from './bag'; +// Q. Why keep "Observe"? Why not do the clever trick of asserting the +// observer, and having the dataspace read the implicit pattern it's +// interested in off its attenuator? +// +// A. (1) Because we want to have the possibility of more than one +// variety of pattern language. For example, here we have a simple +// label match, but we'll quickly want something about as rich as the +// pattern language in attenuators. And later, we could easily want +// something with, perhaps, as much power as RELAX-NG or similar. (2) +// Because we want to have onlookers have some hope of seeing whether +// a pattern of interest to them is being observed, and if we used +// attenuators to match, we'd have to expose visibility into +// attenuators into the pattern language. See next question. +// +// Q. What kinds of constraints on the pattern language are there? +// +// A. (1) It should be fast to evaluate; ideally, JITtable? (2) It +// should allow patterns on patterns, to some degree. We occasionally +// want to observe observers. As such, it'd be good to choose a +// language that enforced some kind of normal forms for its patterns, +// so observer-observers didn't have to deal with spurious variation. +// const Observe = Record.makeConstructor('Observe', ['label', 'observer']); class Dataspace implements Partial {