1. 10 Jul, 2019 1 commit
    • Eric Myhre's avatar
      Finish ErrWrongKind; add typed.Node.Representation · ecad4261
      Eric Myhre authored
      typed.Node.Representation(), which returns another Node, should address
      most of the infelicies we've found so far in trying to plan nice code
      that works over the schema layer.
      
      Also added in this comment: ipld.ReprKindSet, primarily for use in the
      ErrWrongKind error.  It comes up often enough we might as well formalize
      the thing.
      ecad4261
  2. 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
  3. 15 Jan, 2019 2 commits
  4. 14 Jan, 2019 1 commit
    • Eric Myhre's avatar
      Commit some dangling wip code before I warm the refactor cannons. · 63016b7f
      Eric Myhre authored
      I need there to be separate packages for:
      
      - the typed.Node interface, and any top level helpers;
      - the typesystem implementation
      - the typesystem *declarations* (distinct because it's what you
       construct when parsing the ast -- doens't contain pointers yet)
      - and (eventually) a parser and a fmt package for the ts declarations.
      
      And right now all those are heaped together.
      
      Not sure where the validate method -- the thing that's actually touched
      in this diff -- will end up.  Either the top level, or the typesystem
      implementation package, probably.
      Signed-off-by: default avatarEric Myhre <hash@exultant.us>
      63016b7f
  5. 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
  6. 06 Dec, 2018 1 commit
    • Eric Myhre's avatar
      Add Kind and Keys methods to Node. · 5c32434e
      Eric Myhre authored
      And ReprKind moves from the typed package to the ipld main package.
      It's hard to get too much done without the standardization of ReprKind.
      
      Between the Kind() and Keys() methods, it should now be possible to
      perform traversals of unknown nodes.
      
      This diff just worries about implementing all the Kind() methods.
      Keys() has some additional questions to handle (namely, map ordering?).
      Signed-off-by: default avatarEric Myhre <hash@exultant.us>
      5c32434e