DICOM is a curious standard. It's big, extensive, and has gained a lot of cruft over the years. It was in development at times when even TCP/IP had not been published yet. And unfortunately, it has some problems.
At first, it is a very challenging document to read and understand it. The text is unorthodox, uses non-common terminology which requires learning. What is double unusual is that it's based upon the OSI model which today is very unusual. The standard is presented in the form of about ten large PDF files without cross-references.
The DICOM is rooted in the domain of medical care and represents domain entities such as patients, doctors, hospitals, examinations, images, equipment, and software. DICOM introduces its own convoluted tagged binary format similar to ASN.1 to represent, store, and transmit objects and attributes thereof. It also carries the age-old problem of text encodings. This is yet more complicated by bugginess and incompleteness of libraries.
The DICOM situation seems to be slowly getting better.
For now, I have to dig through all of that to make a working software that is compatible with DICOM.
Today I've made a code generator that takes DICOM object structure in the form of an XML file and generates corresponding classes and code to load and save to DICOM files. That made my work much simpler and more productive.
While I was writing all of that, I couldn't help but notice that writing such code is not very convenient if the language does not have macros. So far I had to write 4 distinct pieces of code: the XML schema, the DICOM structures definition in the XML, the object parser, and the code generator. If I would write it in a macro-enabled language I would have only to write 2 pieces of code – the macro definition and the DICOM structure definition. Most text editors still don't support schema-aware XML editing. For example, Visual Studio 2005 has a lot of issues: it sometimes generates nonsensical XML code and sometimes even crashes. So far the best XML editor is Emacs with nxml-mode.
Another observation is the practical aspects of XML and S-Expressions. It's one thing when you need XML schema, XML document, schema-aware editor, validator, parser, etc. and it's another thing when you can just write the normal code that will get expanded during compilation to produce relevant classes and functions.