Skip to content
Samchon edited this page Mar 9, 2018 · 13 revisions

TypeScript-STL

Logo

TSTL is an implementation of STL (Standard Template Library), migrated from C++ to TypeScript. With TSTL, you can enjoy the STL's own specific containers, algorithms and functors in the JavaScript. If TypeScript, you also can take advantage of type restrictions and generic programming with the TypeScript.

TSTL provides most features of STL like below:

Why I've made the TSTL?

In my case

I'm a programmer researching and optimizing algorithms. Most projects about algorithms have a special step; demonstration. In the step, do not consider production and optimization. Only possibility is considered and try to proof the possibility by visulation (demo).

For a such reason, I prefer to using easy script language and visualization tool, like TypeScript & HTML, to demonstrate fast. Using the fast tools (TypeScript & HTML), I've realized some weaknesses of those combination and decided to improve them by myself. It's the reason why I've started the project TSTL.

Deficits of JS Library

Basic library provided in JavaScript is very poor.

Within framework of containers, only Array and Object (dynamic object, it seems very dangerous) are provided. In nowadays, Set and Map have newly added. It had seemed like a good new for a while, however, they also make me feeling deficiency. They're too monotonous.

Functions are dificit, too. Base library of JS does not provide enough functions. It's possible to fill the dificit functions from lots of external libraries. However, in that case, I can't take any advantage of unified design and pattern. Without unified design and pattern, only spagetti code and vulnerable adaptors are left.

In such terrible environment, we can find a solution by turning away our eyes to STL (Standard Template Library). STL is defined by C++ Standard Committee. Their features have unified design and pattern that is clear and reasonable, because they've improved efficiency and unity for a decade years. If such STL features come into TypeScript, it sounds great, isn't it? That's the reason why I've been making and upgrading the TSTL.

For convenient migration

I repeat that, I'm a programmer researching and optimizing algorithms. I prefer implementing demonstration project by TypeScript & HTML. After the demonstration, I'll migrate the program to C++ considering optimization.

Migration means re-writing similar code from TypeScript to C++. Re-writing those codes, haven't I felt inconvenient and anxiety of same designs & interfaces? How comfortable would it be if TypeScript and C++ shares same design and interface in basic level? It's the secondary reason why I've built TSTL.