1. 20 Jul, 2019 2 commits
    • Eric Myhre's avatar
      Add typed.ErrNoSuchField and ipld.ErrNotExists. · 8c6af6f5
      Eric Myhre authored
      The latter isn't used yet; that's not the main goal of this branch (and
      I think I'd rather do the refactor to use ipld.ErrNotExists after
      moving the PathSegment types from the selector package into the root...
      which in turn I'm not going to do while some of the other current work
      on Selectors is in progress in other branches.  So!  Latur.); I just
      wanted it around for documentation and clarity of intent.
      
      This also adds a couple of other dummy references to the 'typed'
      package.  I know keeping a set of packages-used-in-this-file is a
      common step in the development of codegen systems targetting golang,
      but I'm going to try to avoid it until the need is really forced.
      8c6af6f5
    • Eric Myhre's avatar
      Ok, I have learned a hard lesson about embedding. · f6e469ce
      Eric Myhre authored
      Fields in these structs are now named.  Embedding is reserved for
      things that are very explicitly supposed to carry their methods along.
      
      At some earlier point, I embedded the Type field in some of the
      generate structs because it saved me a few keystrokes in refactoring
      template strings.  This was not important.
      
      Today I learned: if you have embeddings which cause a name to be
      shadowed -- as the generateKindedRejections_String.Type field
      could shadow the generateKindString.Type field, for example -- if those
      resolve "neutrally" (I don't know if there's a better technical term
      for this), then... in that case, the templating system will be like
      "yeah, fine, whatev", and it works.  If you give one of those two
      fields a *separate type*, the templating system will now reject it as
      if no field of that name can be found.
      
      I encountered this while working on the generator for structs (which I
      *swear* I will commit any second now, when I stop finding prerequisite
      yaks to shave -- there have been many) and trying to use a more
      specialized TypeStruct instead of the Type interface.  Whee.
      
      I get the logic of this.  The error message could be better.
      
      Anyway: even though it technically didn't affect generateString (yet),
      making the change here for consistency with what's to come
      (including specializing the field even though there's currently no
      actual need for it).
      f6e469ce
  2. 10 Jul, 2019 3 commits
  3. 01 Jul, 2019 1 commit
  4. 20 Apr, 2019 1 commit
    • 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