[ANN] A tool for writing Generic Data Structures/Algorithms

310 views
Skip to first unread message

sa...@asobol.com

unread,
Jun 28, 2015, 4:26:56 PM6/28/15
to golan...@googlegroups.com

https://github.com/sasha-s/go-inline

From the readme:


Generic Data Structures/Algorithms in golang via code generation (glorified copy&paste).

One might one to use goinline tool to generate specific implementation of generic data structures, such as map, vector, matrix, set. Or to generate specific implementation of generic algorithms, such as sort, binary search.

Goals:


  • Write code once

  • Simple, readable and tested tested go code (e.g. no templates/language extensions)

  • Type safety and speed all the way (e.g. no reflection)

  • No magic, everything is explicit


Feedback is very welcome.


Sasha

Nick Craig-Wood

unread,
Jun 29, 2015, 5:49:19 AM6/29/15
to sa...@asobol.com, golan...@googlegroups.com
This looks incredibly similar to my own gotemplate :
https://github.com/ncw/gotemplate which has just the same philosophy of
using template packages.

--
Nick Craig-Wood <ni...@craig-wood.com> -- http://www.craig-wood.com/nick

Alexandre Cesaro

unread,
Jun 29, 2015, 5:51:34 AM6/29/15
to golan...@googlegroups.com, sa...@asobol.com
Did you know gotemplate? Any difference?

sa...@asobol.com

unread,
Jun 29, 2015, 12:58:25 PM6/29/15
to golan...@googlegroups.com, sa...@asobol.com

I did not know about gotemplate.
It seems that it is quite similar indeed.
Some differences:
  • gotemplate uses special `// template` tags in comments.
  • gotemplates tries to be smart and renames the files and and types, goinline is very explicit.
  • gotemplate does not work with multiple source files per template definition(blueprint). This is easy to fix.
  • goinline code is simpler (arguably).
  • goinline can not instantiate non-type template parameters (vars, consts). This is easy to fix.
  • goinline tries not to overwrite files that were not generated by it.
Reply all
Reply to author
Forward
0 new messages