Re: [GSoC] JSON Test suite status

Abdallah Elshamy <[email protected]>
Newsgroups gmane.comp.gnu.octave.maintainers
Message-ID <CAAVkm5AWc7MuVdx8XZT610_Xa3szQTVyRUMyfMntCKHMEyuCWw@mail.gmail.com>
On Mon, Jun 22, 2020 at 10:53 AM Kai Torben Ohlhus <[email protected]>
wrote:

> On 6/22/20 5:19 AM, Abdallah Elshamy wrote:
> > [...]
> > Also in MATLAB, they don't support encoding for complex numbers. Is it
> > better to follow this approach or should we support encoding for it?
> > Maybe encoding it to a JSON object with two keys: "real" and "imaginary".
> > [...]
>
> I cherish your enthusiasm.  For the start it is more than sufficient to
> support what Matlab supports and to do this job perfectly.  If users
> demand the complex encoding feature that much, it can be added at any
> time later.
>
> > Lastly in decoding json objects to structs MATLAB uses makeValidName [4]
> > in converting the keys of the objects to a valid field in the struct (as
> > it doesn't allow the fields of a struct to start with a space or a
> > number ... etc.) As this is valid in Octave, I don't think that this
> > will be necessary. What do you think?
>
> What do you mean by "this is valid in Octave"?  Such calls are neither
> allowed in Octave too
>
>    my_struct.2bad_fieldname = 4
>

What I meant is that if you tried to create the following struct

a = struct("123foo", 2, "foo bar", 5)

in MATLAB (the online version), you will get an error that the field name
is invalid. But in Octave, This struct will be created successfully and it
can be accessed using:

a.("123foo")    or     a.("foo bar")

I think this is not a common way to access structs so it may be better to
use makeValidName despite it is not necessary to call it to create structs
in Octave unlike MATLAB. What do you think?


> Btw. Octave implements that function too [2].
>

I have seen it in Octave. It has some differences (for example "_id" is not
a valid name in MATLAB and becomes "x_id" but it is valid in Octave) that
will require some modifications to the tests when writing BIST.

Best,
Abdallah
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.