Re: how to store list of varying types
"Joseph M. Newcomer"
Thanks for your historical perspective, Joe.
On the other hand, the data structures discussed by the OP are very
trivial structures;
they do not have complex nesting, or need to be checked against various
complex
predicates. The cost of parsing what is essentially a "flat" structure is
very small. So
it is not clear the efficiency arguments are quite as compelling. While
the text can be
xml, a simple parser is a tiny effort to write (a few hours at most for a
flat structure.
I wrote an XML parser from scratch for a complex nested structure in six
hours, including
all the high-level parsing, and I will publish it when I release the
program on my MVP
Tips site, Real Soon Now)
Joe: you can't consider yourself a "benchmark" for programming :) I mean,
you are superior of the "average programmer". If that work took to you 6
hours, I believe for the average programmer it will took much more :)
Moreover, I understand that you have deep knwoledge of compiler technology
(and I think that the parser is a sub-system of compiler technology), so you
must be very familiar with this kind of stuff and parsing algorithms.
Frankly speaking, I would write an XML parser only for learning purposes
(and time spent for learning new things is of course quality time), but for
production code I would use a well written and well tested 3rd party XML
parser like TinyXML (or XmlLite).
(It is kind of like STL containers: I wrote some linked-list and array
classes for learning and practicing some C++, but for production code I
prefer using robust well-tested STL.)
My 2 cents.
Giovanni