Trying to use Mir ion, its a perfect example of the failure of D's attribute system

A moo person moo_mail at fake.com
Thu Jan 19 01:51:41 UTC 2023


This is a semi rant born from frustration. Currently I'm trying 
to figure out Mir Ion so I can serialize some data, and oh boy is 
it frustrating.

The entire library is annotated out the wazoo with @safe and 
@nogc and pure and inout. Its a serialization library so as you 
might imagine it's doing reflection on types, calling member 
functions to try and serialize stuff, things like that. I have 
spent hours now adding attributes and casting attributes away. 
Writing @trusted wrapper types for std.algo ranges. Trying to 
decipher the vomit that dmd gives when one the types is not quite 
right. All I want to do is serialize a list of structs from a 
range and be able to deserialize them back but I can't do that 
because I still have not gotten it working.

It's actually maddening, I have spent 2 days on this. What value 
are all these attributes adding? Because it's a useability 
nightmare. Every time I encounter a D library that tries to be 
clever with these annotations, it's just absolutely made things 
more complex and less useable. Same story every time I have ever 
tried to use them in my own code.


More information about the Digitalmars-d mailing list