https://www.laddoo.net/p/stencil

This is a simple way of creating generic versions of packages that I've 
been prototyping. The main idea is summarised below

   - The generic unit is a package.
   - Specialise a package by substituting one type for another.
   - Import statements define type substitutions. 
   example/num/float64/float32 is example/num with float64 replaced by 
   float32.
   - Generate specialised versions of the packages in a vendor directory.
   - Use the closest vendor directory. If none exist create one.
   - Perform type substitutions with a tool that scans files for these 
   import statements.
   - Use the tool as a format-on-save command in the editor, or run it with 
   go generate.
   - The tool uses type inference to automatically add missing imports with 
   type substitutions

The idea of using import statements to create generic directives is 
borrowed from Gonerics <https://github.com/bouk/gonerics>. The link above 
has more details and examples as well as some pros and cons of this 
approach. A prototype implementation can be found at 
https://github.com/sridharv/stencil. I'd love to hear your thoughts on this.

Sridhar


-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to