DRYing some type ident munges.
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>
Showing
schema/gen/go/munges.go
0 → 100644
Please register or sign in to comment