More progress on Preserves Schemas
Since my last post, I’ve been working some more on Preserves Schemas.
Schema language documented
- The most visible result of this round of work is that I have written a first pass at a specification of the Preserves Schema language. Feedback on the specification and the language very welcome.
Metaschema improvements
-
I also made a major change to the metaschema, moving
setof
anddictof
fromCompoundPattern
toSimplePattern
, and splittingseqof
out fromtuple*
.Placing
seqof
,setof
anddictof
inSimplePattern
rather thanCompoundPattern
makes bothSimplePattern
andCompoundPattern
actually meaningful, and this leads to significant code simplification, which in turn gives me more confidence in the design of the language.Patterns in
SimplePattern
now denote single host-language values without interesting substructure; that is, they are the values of individual fields within a generated record type. Patterns inCompoundPattern
consistently now denote collections of fields rather than individual values.
Reader and checker improvements
-
I improved checking of schemas at “read” time. The checker no longer requires knowledge of generated types for any particular host language. Schema well-formedness is purely an AST property.
-
The checker now checks for duplicate variant names in a union, alongside the existing duplicate-binding and invertibility checks.
Schema implementation improvements
-
I implemented a second reader, in Racket. This drove a number of small improvements in the Racket preserves implementation and the rest of the Racket preserves-schema codebase.
-
I also added a nascent test suite for the TypeScript schema package.