![]() |
|
|
|
|
DiSTiL is much more powerful than traditional static libraries for data structures. The programmer doesn’t have to worry about how things are done. The only thing that matters is what needs to be done and DiSTiL will take care of the details very efficiently.
Imagine that you need to create a data-structure that consists of two seperate elementary structures (think of the phone-book example). In a static library this would be quite hard to do. The conventional solution is to store the elements only once and create a second structure (index) with pointers to the elements. Even if we ignore the run-time inefficiencies that this solution introduces, the programmer will have to maintain the data structure on his/her own. This may include writing new comparison functions for the indexes (so as to compare the indexed elements and not the index values). Additionally, the code that uses the two data-structures is completely separate and hard-coded into the resulting application. If later a certain kind of retrieval is best served by a different kind of data-structure, the programmer will need to change all such operations by hand.
Consider, also, how difficult it is to provide error checking in static libraries. The example of STL is typical: the library programmer has no control over template compositions. A class that supports a certain operation may be expected but the library has no way to check this. All error messages will be reported by the compiler after the composition (macro-expansion) has been attempted. At that stage it is very difficult to report errors accurately and with informative messages. Error messages generated by template libraries are notorious for being very cryptic and often misplaced. This is not surprising: at that level all the intentional information of the composition has been lost.
On the other hand, DiSTiL has very powerful error checking capabilities -- not even limited to traditional type checking. Arbitrary attributes can be assigned to library components and propositional properties on them can be automatically checked.