- 01 Apr, 2020 1 commit
-
-
Eric Myhre authored
Compiles and runs; but the results don't. Some small issues; some big issues. Just needed a checkpoint. It's feeling like it's time to deal with breaking down the assembler generators in the same way we did for all the node components, which is going to be kind of a big shakeup.
-
- 29 Mar, 2020 3 commits
-
-
Eric Myhre authored
I *think* the notes on Maybes are now oscillating increasingly closely around a consistent centroid. But getting here has been a one heck of a noodle-scratcher.
-
Eric Myhre authored
-
Eric Myhre authored
In research: I found that there are more low-cost ways to switch which methods are available to call on a value than I thought. Also, these techniques work even for methods of the same name. This is going to improve some code in NodeAssemblers significantly -- there are several situations where this will let us reuse existing pieces of memory instead of needing to allocate new ones; even the basicnode package now already needs updates to improve this. It's also going to make returning representation nodes from our typed nodes *significantly* easier and and lower in performance costs. (Before finding methodsets are in fact so feasible, I was afraid this was going to require our typed nodes to embed yet another small struct with a pointer back to themselves so we can have amortized availability of value that contains the representation's logic for the Node interface... which while it certainly would've worked, would've definitely made me sigh deeply.) Quite exciting for several reasons; only wish I'd noticed this earlier. Also in research: I found a novel way to make it (I believe) impossible to create zero values of a type, whilst also making a symbol available for it in other packages, so that we can do type assertions, etc, with that symbol. This is neat. We're gonna use this to make sure that types in your schema package can never be created without passing through any validation logic that the user applies. In codegen: lots of files disappear. I'm doing a tabula rasa workflow. (A bunch of the old files stick around in my working directory, and are being... "inspirational"... but everything is getting whitelisted before any of it ports over to the new commits. This is an effective way to force myself to do things like naming consistency re-checks across the board. And there's *very* little that's getting zero change since the changes to pointer strategy and assembler interface are so sweeping, so... there's very little reason *not* to tabula rasa.) Strings are reimplemented already. *With* representations. Most of the codegen interfaces stay roughly the same so far. I've exported more things this time around. Lots of "mixins" based on lessons learned in the prior joust. (Also a bunch of those kind-based rejections look *much* nicer now, since we also made those standard across the other node packages.) Some parts of the symbol munging still up in the air a bit. I think I'm going to go for getting all the infrastructure in place for allowing symbol-rename adjunct configuration this time. (I doubt I'll wire it all the way up to real usable configuration yet, but it'll be nice to get as many of the interventions as possible into topologically the right places to minimize future effort required.) There's a HACKME_wip.md file which contains some other notes on priorities/goals/lessoned-learned-now-being-applied in this rewrite which may contain some information about what's changing at a higher level than trying to track the diffs. (But, caveat: I'm not really writing it for an audience; more my own tracking. So, it comes with no guarantee it will make sense or be useful.)
-
- 17 Oct, 2019 1 commit
-
-
Eric Myhre authored
This introduces several new methods to the type generator. The new comment at the top of 'gen.go' explains the direction. There are several (sizable impact) TODOs in the methods for structs; this is because some other research I've been doing on performance is going to result in a re-think of how we regard pointers, and a *lot* of the struct code is going to get a shakeup shortly. Should be coming up in about two commits or so. (The 'Maybe' structs getting their first mention here will have something to do with it!) Some more file split-ups to keep node interface generation separate from native-typed API generation will be coming up next commit. You can also see here some TODOs regarding the future possibility of "validate" methods. This is something I want to pursue, but the implementation work will be nontrivial -- those TODOs will probably stay there a good while. Signed-off-by: Eric Myhre <hash@exultant.us>
-
- 01 Sep, 2019 3 commits
-
-
Eric Myhre authored
I'm not sure if I like these symbol names. Or rather, I don't, but haven't decided on what would be preferable yet. There's a couple of options that have come to mind: - option 1 - `func {{ .Type.Name }}__NodeBuilder() ipld.NodeBuilder` - `func {{ .Type.Name }}__ReprBuilder() ipld.NodeBuilder` - option 2 - `func NewBuilderFor{{ .Type.Name }}() ipld.NodeBuilder` - `func NewReprBuilderFor{{ .Type.Name }}() ipld.NodeBuilder` - option 3 - `func (Builders) {{ .Type.Name }}() ipld.NodeBuilder` - `func (ReprBuilders) {{ .Type.Name }}() ipld.NodeBuilder` Option 3 would make 'Builders' and 'ReprBuilders' effectively reserved as type names if you're using codegen. Schemas using them could use adjunct config specific to golang to rename things out of conflict in the generated code, but it's still a potential friction. Option 2 would also have some naming collision hijinx to worry about, on further though. Only Option 1 is immune, by virtue of using "__" in combination with the schema rule that type names can't contain "__". This diff is implementing Option 1. I think I'm partial to Option 3, but not quite confident enough in it to lunge for it yet. Putting more methods on the *concrete* types would also be another interesting fourth option! These methods would ignore the actual value, and typically be used on the zero value: e.g., usage would resemble `Foo{}.ReprBuilder()`. The upside of this would be we'd then have no package scoped exported symbols except exactly the set matching type names in the schema. However, the opportunities for confusion with this would be numerous: we couldn't use the 'NodeBuilder' method name (because that's the potentially-stateful/COW one), but would still be returning a NodeBuilder type? Etc. Might not be good. More to think about here in the future. Signed-off-by: Eric Myhre <hash@exultant.us>
-
Eric Myhre authored
Fixed at least one bug along the way (in iterators, which don't have test coverage yet, so no test fix. Still planning to cover those via serialization, when we get that feature, "soon"). 'go doc .' on the generated code now only lists one type per type in the schema which seems like a good sanity heuristic; and 'go doc -u .' on the package now looks much more consistent. (There's *8* types for every struct in the schema! Uffdah. But if that's what it takes to make a focused, correctness-emphasizing library surface area, so be it.) Signed-off-by: Eric Myhre <hash@exultant.us>
-
Eric Myhre authored
I'm still aiming to keep this as simple and un-clever as possible, because putting lipstick on a pig -- this is all about to become strings which get shoveled back to a compiler parser anyway -- is not useful, and becomes antiuseful if it obstructs readability... But I'm starting to find these elements are repeated enough that it will help rather than hurt readability to extract some things. Also, since the munges have recently started to appear in both go code source as well as in the templates, that starts to put more weight in favor of extracting a function for it, which keeps the two syntactic universes from drifting on this subject. At the same time, moved all NodeBuilders to being unexported (by using idents prefixed with a "_"). I looked at the godoc for the generated code and felt this is looking like a wiser choice than exporting. We'll need to export more methods for getting initial instances of the now-unexported stuff... but we should be adding those anyway, so this is not an argument against unexporting. Some additional type idents around iterators and map builders have not yet been hoisted to DRYed munge methods. I'm debating if that's useful (as you can see in the comments in that file), but leaning towards it being more parsimoneous to just go for it. So that'll probably be the next commit. Signed-off-by: Eric Myhre <hash@exultant.us>
-
- 11 Aug, 2019 1 commit
-
-
Eric Myhre authored
This has been on the clipboard for a while now. When I first wrote it, the idea that we'd need multiple NodeBuilders per typed Node seemed a little staggering; now that the idea has had a while to cook, it seems clear and uncontrovertial, so this diff now looks like far less of a noodle-baker than it originally was. (I had been planning to switch to working on runtime (that is, wrapper-based, non-codegen) typed nodes for a while to validate this idea, and now I have some partial diffs from that to land too, but the validation returned "true", so now I regret having multiple irons in the fire... sigh! Software development is hard.) Signed-off-by: Eric Myhre <hash@exultant.us>
-
- 20 Jul, 2019 1 commit
-
-
Eric Myhre authored
This isn't a net negative size diff yet, but it certainly will have that effect momentarily when we add a generator for another kind. More importantly, it reduces the set of functions in the real generator file to *just* the relevant ones. We'll almost certainly extend this to cover the NodeBuilder half of things as well, later; I just haven't gotten there yet.
-
- 10 Jul, 2019 2 commits
-
-
Eric Myhre authored
Signed-off-by: Eric Myhre <hash@exultant.us>
-
Eric Myhre authored
-