• Eric Myhre's avatar
    Union generation complete, and keyed repr; tests; and they pass. · f62d9445
    Eric Myhre authored
    I can't quite claim tests passed on the *first* shot... but,
    the first shot after mostly syntactical (rather than semantic) fixes?
    Yeah, actually.  That was pretty fun.
    
    Snuck in a bit of DRY'ing up.  The repetition in BeginMap methods
    got to me, and was low hanging fruit, so I extract that from unions
    and also backported it to structs.
    
    Errors got some work in this commit, because it turns out I've
    straightjacketed myself by not allowing "fmt.Errorf" due to imports.
    There's a lot to do there, and I only tackled what was directly
    critical to get this commit about unions across the finish line,
    but there's a few remarks in comments about where to go next.
    
    Some more comments about future work on the type info holder types
    also appears; I'm starting to skid on those placeholders and their
    issues more and more.  I really hope we can get to replace those
    sooner than later.
    
    And... also, yes, the idea of not having a "focus" state field in
    assemblers really bit it, hard, as speculated in the previous
    commit message.  I ended up using 'ca' in more switches than I
    expected, simply because it's easier to use that than have the
    conditonal templating branches that would be necessary to use the other
    tagging mechanisms that do also have sufficient info.
    
    One big fixme in the core interfaces for nodebuilders (wince):
    the ValuePrototype method can error sometimes, and that hasn't been
    accounted for.  Need to make a decision about what to do there.
    It's not really an exercised path in practice, but it shouldn't
    contain caltrops, regardless of how frequently used it is.
    (This probably would've come up earlier, except there's a bunch of
    stubs about ValuePrototype in other parts of codegen already; all of
    them need backfill, but haven't yet made it to top of the todo heap.)
    
    But despite all the fixmes accumulated, this does bring unions
    to be a usable thing, and definitively proves out that the design
    still works, even for what turns out to be one of the most complicated
    parts of the schema system!  It's very, *very* exciting to add the
    checkmarks to this part of the feature table -- it's one of the places
    I most feared "unknown unknowns", now it's put to bed.  Woot!
    f62d9445
tmpBuilders.go 3.97 KB