Friday, March 12, 2010
AVL Tree for Google's New Go Language
Anyone interested in Google's new Go language should check out my open-source AVL Tree. It was originally crerated as a C++ class and a template, used in my HERMIT program. Porting it to Go was an interesting exercise. First, I didn't need my heap allocator because Go's garbage-collected memory manager already does block allocations. Perhaps the most interesting part of the port, however, was moving from a class hierarchy way of thinking to Go's interface-based programming, which is more akin to "duck typing." I was able to add some interesting iterators similar to those in other Go containers, but until Go has generics I can't add that. Overall, it was an interesting study in simplifying the code. Assuming that Go grows and scales, it is shaping up to be a powerful programming tool with much of the simplicity of script languages.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment