First pass typedeclaration->typesystem construct!
Most of the meat is implemented, with a few important exceptions.
For many of the more simple kinds of type, it's pretty cookiecutter:
e.g., for bools and strings and the other simple scalars, it's just
copying over the descriptions to the immutable objects in the
typed/system package, and it's done.
For maps and arrays and other recursive types, a little more code
is involved: we do a two-pass approach to make sure we get all the
named type declarations enumerated first, and then go back to review
the recursive kinds again, and now check and reify their recursive
references. That's pretty straightforward as well.
The one problem here is... we didn't account for inline anonymous
type definitions, e.g. the `struct { field {Foo:[Bar]} }` syntax.
That requires some significant fixing in the typed/declaration
structs; they don't have the right recursivity at all right now.
I started punting out to todo comments rather than properly finishing
the construction of the struct and union types after making that
realization about anonymous inline type definitions. I'd like to
hammer out the correct recursivity in the declarations types before
coming back and doing a final finishing pass on this.
And one more side-note: I turned TypeName into an alias between the two
packages because it reduces syntactic irritation and casting.
Up next: well, we did all this first pass work on typedeclarations, but
something's been under-regarded: a core design goal is to make sure
these schema declarations are self-describing and serialize clearly
in the IPLD Data Model formats. Let's spend a bit of time on that.
(What I *really* want is to have *codegen* make the whole suite of
the typed/declaration package contents straight from a schema! But
we've got a bit of a bootstrapping cycle there, of course, heh heh.)
Signed-off-by: Eric Myhre <hash@exultant.us>
Showing
Please register or sign in to comment