Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Self-hosting gen of the schema-schema. #62

Merged
merged 1 commit into from
Jul 30, 2020

Commits on Jul 27, 2020

  1. Self-hosting gen of the schema-schema.

    ... With a few minor alterations.
    
    I've taken the opportunity to make a few tweaks to naming as I went.
    
    A few cases use keyed unions when they should be kinded; this is a
    significant todo.
    
    A few cases use keyed unions where the schema-schema declaration says
    they should use inline representations!  In these, I've come to believe
    the schema-schema made a mistake; we probably will update it.
    
    The overall structure, however, is not significantly diverged.
    
    The whole specification is still written in code: the 'SpawnFoo'
    placeholder methods are in heavy use.  (This might herald the beginning
    of the end, for them, though!)  (We're also still making little
    hacks to dodge the current placeholder typeinfo's lack of support
    for inline defns; but this is purely a problem of the placeholder
    typeinfo structures, and can disappear the instant we replace them.)
    
    If you run this generation, the emitted code is (aside from those
    caveats listed above) suitable for parsing schema declarations.
    
    ...!
    
    Which means... we can soon turn around and start using this to build
    up tooling which actually uses schema JSON as a config mechanism.
    Which will then bring us quite a bit closer to being able to make
    free-standing usable CLI tools for working with further codegen.
    
    There's a few other bits to go.  For starters, right now, this is
    just generating output into a demo output dir.  I've made no attempt
    in this commit to rig it up as a proper snake-eating-its-tail by
    replacing the 'SpawnFoo' methods and placeholder type info; that'll
    come in due time.  (And I think we may still have fun choices coming
    up with that, incidentally; the distinction between string type names
    and reified pointers is still looming, and we need to figure out what
    the story is for gen outputs containing their own type descriptions
    (which may touch on the same interface design choices); etc.)  I'll
    probably move somewhat cautiously with this, and only cut over after
    polishing the gen outputs some more... but it's now near in reach.
    
    The size of the generated output is also very likely to need work.
    We're looking something on the order of 1.6MB of generated output.
    (It's *highly* redundant: if you gzip it, it's 95kb.)  Mind: I've made
    *no* effort whatsoever to bring this down.  So, it's probably safe to
    assume we'll find some low-hanging fruit when we actually look into it.
    (I'm not yet sure what the bar will be for satisfaction with this:
    I regard the current number as vaguely "seems rather high", but it's
    also for a fairly sizable schema and for a lot of features provided,
    so maybe some size trades are just what we're going to face in golang.)
    
    That's it.  There will probably be some PRs to the schema-schema
    documents in the specs repo shortly.  Other than those, this should
    also be about ready to line up with and parse JSON output created
    by the other IPLD Schema DSL->JSON parsers we already have, which
    could start unlocking some really neat stuff.  🎉
    warpfork committed Jul 27, 2020
    Configuration menu
    Copy the full SHA
    24b27ea View commit details
    Browse the repository at this point in the history