"Phango" container classes
Bill Baxter
dnewsgroup at billbaxter.com
Sun Sep 30 23:24:09 PDT 2007
I just decided to do a little experiment to see how hard it would be to
make Tango's containers work with Phobos.
Answer: less than an hour's work.
Here's all it takes:
- Copy tango/util/collections/* to phango/util/collections/*.
- Copy tango/core/Exception.di to phango/core/Exception.d
- Replace all instances of 'tango' with 'phango'.
- Replace all instances of 'toUtf8' with 'toString'
- Comment out the IReader,IWriter imports in LinkMap.d
- Comment out all function prototypes in Exception.d.
- Make TracedException a simple subclass of Exception in Exception.d.
- Comment out anything else in Exception.d that gives compiler errors.
Then voila! You have a set of container classes for Phobos.
I did some rudimentary testing by copying all the unittests from the
containers to one big containers.d test program. After changing Cout's
to writefln's, all seems to work like a charm.
So this is a possible option for anyone who would like a set of
Java-esque container classes to use with Phobos. Certainly a heck of a
lot easier than trying to port any implementation of C++ std::map to D. :-)
--bb
More information about the Digitalmars-d
mailing list