May 16, 2014
Before I talk about the next set of updates for the TypeScript data structures & algorithms library I am working on I wanted to discuss some of the setbacks I faced. The first was that I ran into a huge problem with the internal module system as described by this codeplex issue. Essentially the dependency resolution only uses file references which can result in in single file output not ordering the TypeScript files by dependencies. This means the single file output will immediately throw an undefined error when loaded into the browser making internal modules useless and the library broken. Other than maintaining a separate list of correct dependency order per build, I would need to switch to external modules. This made me reconsider the use of internal modules and I decided external modules would be more useful for the following reasons.
The other setback I had was that I had failed to realize that ES6 Maps, WeakMaps, and Sets performed key equality based on the built in equals operation. This means that two objects which had identical properties would still be not the same key and would not allow the user to modify how keys are compared. I wanted my data structures to have user definable hashCode and equals methods to determine key equality instead of this. So I went back and made the necessary changes to accomplish this. The Sets I chose to implement were HashSet, and TreeSet. Sets are a collection of unique elements. Sets can be found here
Similar to a set, I also implemented some MultiSets which are collections of unique elements that allow duplicates. Each unique element is associated with a count integer determining how many of a given unique element has been added to the MultiSet. Elements remove from a MultiSet reduce the count. The MultiSets can be found here
The last update was a Stack which is a linear collection of elements which is last in first out. I chose to implement the ArrayStack. The stacks can be found here.
This update was filled with setbacks and progress. However the library has come along mostly on schedule and I am happy with the progress.
Written by Cody Stebbins who is a full-stack software engineer living in Austin, TX. Twitter