Lady [Wed, 14 Jun 2023 04:42:16 +0000 (21:42 -0700)]
Give Tag constructors a superclass
This “simplifies” the static method definitions on Tag constructors
by giving the constructors themselves private fields and using a method
implementation common to all of them (on their prototype chain), rather
than manually defining each with partial application during initial
constructor generation.
This is also somewhat desirable as it means that the expected situation
of :—
Lady [Wed, 14 Jun 2023 02:48:09 +0000 (19:48 -0700)]
Use configurable metadata for model
Instead of hardcoding properties and methods, use a schema to generate
them. This makes the code significantly dry·er at the cost of some
slightly obtuse metaprogramming.
The schema format is somewhat minimal and makes some assumptions; this
is not intended as a generalist O·W·L processor or anything of the
sort.
Previously, `TagSystem::Tag` returned a bound class constructor. With
this commit, it instead returns a (manually‐defined) constructor
function which effectively does the partial application in its function
body. Each constructor has its own unique prototype object (inheriting
from `Tag.prototype`) and its own static methods (bound forms of `Tag`
static methods). Constructors themselves inherit from
`Function.prototype` (for now).
Lady [Wed, 14 Jun 2023 02:02:55 +0000 (19:02 -0700)]
Always return (the same) objects for langstrings
Instead of returning a string literal in some cases and a `String`
object in others, always return an object when processing language
strings. Use a cache and registry to always return the same object for
any given value and language, to allow `Set` operations to work as
expected.
Lady [Mon, 29 May 2023 05:18:55 +0000 (22:18 -0700)]
Initial Tag model
Work is still needed here to allow `TagSystem`s to replay the
activities generated by persisting tags, but the `Tag` part of this is
close and working.