mauricelam / genny

Elegant generics for Go
MIT License
24 stars 6 forks source link

Renaming Types after codegen #11

Open prateek opened 5 years ago

prateek commented 5 years ago

Hey @mauricelam!

First, thank you for the work on the library. We really appreciate the work you've put into it.

We use it extensively for generating type aware collections like maps, slices and a lot more. It works great for our needs. Our biggest gripe with it is how we handle renaming of the generated types.

For example: (1) here's a maketarget for a map type: https://github.com/m3db/m3/blob/master/src/dbnode/generated-source-files.mk#L71-L81 (2) the make target for (1) uses a generic map generation target: https://github.com/m3db/m3/blob/master/src/x/generated-source-files.mk#L38-L45 (3) the make target for (2) also uses gorename to change the name of generated types: https://github.com/m3db/m3/blob/master/src/x/generated-source-files.mk#L56-L104

We'd really like to make the equivalent renaming natively part of the library. Would you be open merging something like that in? I'm happy to do the work you're up for it.

mauricelam commented 5 years ago

Yes I think that would be a great idea! It would be great if we can have a flag that allows users to opt-in to this behavior though.