1. 25 Jun, 2019 1 commit
    • Eric Myhre's avatar
      Refactor of type/schema code. · 122c5338
      Eric Myhre authored
      - `typed.Node` -> now lives in the `impl/typed` package, more like
      other nodes.
      
      - Most of the other essential parts of reasoning about types moved
      to `schema` package.  ("typed.Type" seemed like a nasty stutter.)
      
      - `typed.Universe` renamed to `schema.TypeSystem`.
      
      - Current `Validate` method moved to `schema` package, but see new
      comments about potential future homes of that code, and its
      aspirational relationship to `typed.Node`.
      
      Conspicuously *not* yet refactored or moved in this comment:
      
      - The `typed/declaration` package -- though it will shortly be scrapped
      and later reappear as `schema/ast`.  The dream is that it would be
      neatest of all if we could generate it by codegen; but we'll see.
      (This would seem to imply we'll have to make sufficient exported
      methods for creating the `schema.Type` values... while we also want
      to make those immutable.  We'll... see.)
      
      - The `typed/gen` package is also untouched in this commit, but
      should similarly move shortly.  The codegen really ought to be built
      against the `schema.Type` reified interfaces.
      
      Overall, this drops the sheer nesting depths of packages a fair bit,
      which seems likely to be a good smell.
      122c5338
  2. 16 Mar, 2019 1 commit
    • Eric Myhre's avatar
      Drop MutableNode interface. · 6428f14f
      Eric Myhre authored
      This has been deprecated and replaced by the NodeBuilder system
      for a good while now; time to scrape it into the dustbin completely.
      
      Tests that were primarily on the mutable node system itself also
      drop, so, this is a *very* large delete diff.
      
      A few other tests used MutableNode just incidentally, and those are
      quick fixed to use NodeBuilder.
      Signed-off-by: default avatarEric Myhre <hash@exultant.us>
      6428f14f
  3. 15 Jan, 2019 3 commits
    • Eric Myhre's avatar
      Introduce typedeclaration package. (Think "AST".) · b066cf1b
      Eric Myhre authored
      All of these struct definitions are horrifying similar in construction
      to the same-named definitions in the typesystem package: simply ever
      instance of a Type pointer is instead a TypeName string.  Despite being
      unattractive, this is correct: since typesystem can have pointers and
      cycles, and typedeclaration can't, this is what we end up with.
      Signed-off-by: default avatarEric Myhre <hash@exultant.us>
      b066cf1b
    • Eric Myhre's avatar
      Each 'Type*' now has read-only methods. · c9cf2100
      Eric Myhre authored
      ...and all fields are correspondingly unexported.
      
      We're going full immutability on almost all this stuff.  I simply can't
      imagine handling and maintaining this any other way.
      
      The typesystem.Type interface also got a few more standard methods.
      I'm not sure if having a Universe backpointer is going to be useful
      very often or not, but it seems reasonable enough to do; we'll
      definitely *have* that information during consistency checking and
      reification time, so it should turn out easy to keep it.
      
      The validate_test.go code is now looking a bit janky.  We need
      initializers for the typesystem.Type* values.  Those will be the
      typedeclaration.* package... which we'll write next.
      
      Note that I skipped any accessor methods on `Type*` objects which are
      for representation details.  These might get filled in later, but I'm
      gonna see how far I can get without them.  (So far, there's some
      uses of the representation details in the validate method, but we've
      located that in the typesystem package anyway, so that's... fine.)
      Signed-off-by: default avatarEric Myhre <hash@exultant.us>
      c9cf2100
    • Eric Myhre's avatar
      Reboot typed dir. Now with child packages. · c8e3e1d4
      Eric Myhre authored
      See previous commit for more discussion of the child packages to come,
      or the schema.md file in the docs dir, which describes similar.
      
      Several large todos in comments.
      
      Quite importantly: typed.Node is now an **interface**, not a concrete
      struct itself.  The godoc comment should explain this nicely; long
      story short, this is going to be relevant when we get to codegen and
      other advanced form of native integration.
      Signed-off-by: default avatarEric Myhre <hash@exultant.us>
      c8e3e1d4
  4. 08 Dec, 2018 1 commit
    • Eric Myhre's avatar
      Begin schema validation method. · b66f9261
      Eric Myhre authored
      This will be for the active path -- if we also follow through on the
      idea of having a just-in-time checked Node wrapper, a lot of these
      checks might end up duplicated.  We'll DRY that up when we get there.
      
      Doing accumulation of errors.  Might get loud.  We can come back and
      and early-halt parameters or other accumulation strategies later.
      
      Added IsNull predicate to core Node interface.
      
      Going to want enumerated error categories here for sure, but punting
      on that until we get more examples of what all the errors *are*; then
      I'll come back and tear all this 'fmt.Errorf' nonsense back out.
      Signed-off-by: default avatarEric Myhre <hash@exultant.us>
      b66f9261