• Eric Myhre's avatar
    New take on schema codegen. · 52033884
    Eric Myhre authored
    The previous code was lots of switches; I think it's safe enough to
    say that wasn't going to scale or compose very easily.
    This new take is based on some interfaces and a wee dusting of
    polymorphism.
    
    The abstraction *won't* hold: we'll drill through it in many places,
    and there will still be type switches up the wazoo by the end -- see
    the comments already scattered about regarding maps and enums and such.
    But that's okay; a few interfaces will still help; at the very least
    it makes things a bit more structurally self-documenting.
    
    Strings (and one particular representation and node implementation of
    them) are all that's included here, but so far so good.
    
    The comment above, and the one in the code about "triple cross
    product", probably waggle towards what's going to be the trickiest
    part of this: codegen needs to take into account a *lot* of choices.
    Making the code for this maintainable is going to be nontrivial!
    Signed-off-by: default avatarEric Myhre <hash@exultant.us>
    52033884
gen.go 2.42 KB