octave-patch-tracker
[Top][All Lists]
Advanced

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

[Octave-patch-tracker] [patch #9980] JSON encoder and decoder, alternati


From: anonymous
Subject: [Octave-patch-tracker] [patch #9980] JSON encoder and decoder, alternative to object2json
Date: Wed, 28 Oct 2020 11:53:50 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:81.0) Gecko/20100101 Firefox/81.0

Follow-up Comment #22, patch #9980 (project octave):

On the quoted quoted-string, that's could be a bit tricky.  I will look into
it.

On the difference in '[]' and 'NaN' for "null"...originally "fromJSON"
conditionally return '[]' for "null": 'NaN' if in numerical array, '[]' if in
mixed-class array.  However, given that Octave is a *numerical* computing
environment, I made a deliberate choice to instead always make "null" into
'NaN'.  Aside form the symmetry to "toJSON" reflexively turns all 'NaN' to
"null", "fromJSON" does recursive processing, and I worried about some
edge-cases causing confusion.

I attribute this comprimise to what I regard as gross (teeth-grinding!)
negligence in the JSON spec, which fails to accommodate for 'NaN' and 'Inf'
despite both being valid IEEE754 values *and* valid Javascript values. 
Besides, an empty-array is possible in JSON, so converting "null" to '[]' is a
similarly dubious comprise.

In the end, with regards to NaN, [], UTF encoding, etc., this comes down to
what is being transported via JSON: numerical dataset or information.  I was
setting out to solve the problem of transporting numerical data (i.e.
numerical ins and outs of Octave functions as backend to Javascript), where as
'jsonecode/decode' might have settled on transporting information (i.e.
processing HTTP requests, etc).

On the ND array, I will look at that.  ND arrays hurts my brain, so I still
have to wrap my head around what you show.


    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/patch/?9980>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

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