poke-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [RFC] New JSON representation for Poke values in MI


From: Kostas Chasialis
Subject: Re: [RFC] New JSON representation for Poke values in MI
Date: Tue, 24 Aug 2021 00:08:50 +0200

Hi Mohammad,


> 
> A few minor comments:
> 
> 1. What about removing the "value" field from "PokeValue"?
> 
> 
> ```
> ##
> 3500 as uint<32>
> ##
> {
>    "PokeType": {
>        "code": "Integral",
>        "info": {
>            "size": 32,
>            "signed_p": false
>        }
>    },
>    "PokeValue": {
>        "value": 3500
>    }
> }
> ```
> 
> to
> 
> ```
>    ...
>    "PokeValue": 3500
> }
> ```
> 
> And
> 
> ```
> ##
> "foo"
> ##
> {
>    "PokeType": {
>        "code": "String",
>    },
>    "PokeValue": {
>        "value": "foo"
>    }
> }
> ```
> 
> to
> 
> ```
>    "PokeType": { "code": "String" },
>    "PokeValue": "foo"
> ```
> 
> And in structs, instead of
> 
> ```
>    ...
>    "PokeValue": {
>        "fields": [
>            {
>                "value": 1
>            },
>            {
>                "value": 2
>            }
>        ],
>    ...
> ```
> 
> ```
>    ...
>    "PokeValue": {
>        "fields": [1, 2],
>    ...
> ```
> 
> Ditto for arrays.


We can’t do that because “PokeValue” is of “type”: “object” so all “$refs” have 
to be of type “object”
If we remove value from Values we will have something like

“StringValue”: {
        “type”: “string"
}

or

“IntegralValue: {
        “type”: “integer"
}

which are not of type “object”. I think the minimum we need is one property, 
“value”.

> 
> 2. The "unit" can be removed from the "PokeValue", because that's already part
> of the type. Instead of
> 
> ```
> ##
> 23U#B
> ##
> {
>    "PokeType": {
>        "code": "Offset",
>        "info": {
>            "base_type": {
>                "code": "Integral",
>                "info": {
>                    "size": 32,
>                    "signed_p": false
>                }
>            },
>            "unit": 8
>        }
>    },
>    "PokeValue": {
>        "magnitude": 23,
>        "unit": 8
>    }
> }
> ```
> 
> We can have:
> 
> ```
>    ...
>    },
>    "PokeValue": {
>        "magnitude": 23
>    }
> }
> 
> ```
> 
> Or even this:
> 
> ```
>    ...
>    },
>    "PokeValue": 23
> }
> ```
> 

Agree on this, we shall have it removed.

> Regards,
> Mohammad-Reza




reply via email to

[Prev in Thread] Current Thread [Next in Thread]