-
Eric Myhre authored
Generates the struct itself (including the variations of pointers and/or extra fields necessary), There are several major TODOs outstanding; and the generated code doesn't *quite* compile due to several missing references, namely: - ipld.ErrNoSuchField - ipld.Nil - ipld.Undefined The other issues remaining: - The reason ErrNoSuchField is missing is because it needs to be decided where an error like that should go. Is it meaningfully distinct from a general "key absent" error, like a map can return? If it is indeed a distinct thing, does it go in the schema package, or will that just make things annoying until the end of time since every occurence-site-sibling error is in the ipld main package? - We need to think about typed nil / typed undefined. I suspect they are an idea to be avoided (but doing so means using the NodeBuilder() method on the nil or undefined values from a struct will *not* "DTRT", which may be problematic; this can in turn be avoided by "knowing" you're working on a typed node, but, erm. It turns into a question of which of these things is less annoying). - We'll need to backtrack up to the main ipld.Node interface and add that 'IsUndefined() bool' method now! (Or, take a radical approach of using a magic const for that. But... no, that doesn't sound fun.) - Haven't even touched the NodeBuilder yet. (And the typeGenerator interface needs to have those bits broken down, as well, so that we can do good stuff with error path codesharing as with funcs for Node.) - Haven't filled in MapIterator. But that's probably just easy chug. Lots to do, in short. I just need a checkpoint. Note how we've had this on the clipboard for a while already, heh -- the info_test.go file and TestUnderstandingStructMemoryLayout have been aimed at this; notice how any extra bool fields are generated at the bottom of the emitted struct. Many yaks have been shaved in the meanwhile, and yet look at how many we have to go. Isn't this fun? Signed-off-by: Eric Myhre <hash@exultant.us>
6898ed22