dmd json file output

Walter Bright newshound2 at digitalmars.com
Sun Jan 20 23:27:57 PST 2013


The current version is pretty verbose. For:

     int ***x;

it will emit as the type:

"type" : {
         "kind" : "pointer",
         "pretty" : "int***",
         "targetType" : {
                 "kind" : "pointer",
                 "pretty" : "int**",
                 "targetType" : {
                         "kind" : "pointer",
                         "pretty" : "int*",
                         "targetType" : {
                                 "kind" : "int",
                                 "pretty" : "int"
                         }
                 }
         }
}

I find this to be excessive, and it helps to produce truly gigantic .json files. 
I think it's better to just put out the deco for the type:

"type" : "PPPi"

But, you might say, that is not user friendly! Nope, it isn't. But the .json 
output is for a machine to read, not humans, and the deco types are very space 
efficient, and are trivial to convert to whatever data structure the reader 
needs. Much easier than the verbose thing.

What do you think?


More information about the Digitalmars-d mailing list