[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-patch-tracker] [patch #9980] JSON encoder and decoder, alternati
From: |
Philip Nienhuis |
Subject: |
[Octave-patch-tracker] [patch #9980] JSON encoder and decoder, alternative to object2json |
Date: |
Mon, 26 Oct 2020 04:07:21 -0400 (EDT) |
User-agent: |
Mozilla/5.0 (Windows NT 6.1; rv:52.0) Gecko/20100101 Firefox/52.0 |
Follow-up Comment #9, patch #9980 (project octave):
Thanks for the new patches.
Where in comment #2 I wrote that in Octave-7.0.0 these functions will become
obsolete, if they are in the io package they should still run w/o issues for a
few years until usage of then older Octave Out There is low enough. I think
that is not unreasonable.
I checked and tested a few thing and I see the following in Octave-7.0.0:
>> test toJSON
***** test ## PREC input arg test
assert(toJSON(pi, 0),'3')
assert(toJSON(pi, 5),'3.1416')
assert(toJSON(pi, -5),'3.1416')
assert(toJSON(pi, 25),'3.141592653589793115997963')
assert(toJSON(pi, :),'3.14159265358979')
assert(toJSON(pi, []),'3.14159265358979')
assert(toJSON(pi, false),'3.14159265358979'); ## this is provoking stmt
assert(toJSON(pi, {}),'3.14159265358979'); ## issue warning here
!!!!! test failed
invalid empty index expression
due to this statement on L.72:
[PREC,COMPACT] = {[],PREC}{};
which (as we have discussed) is difficult to disentangle.
As of Octave-7.0.0 empty indexing e.g., var{}, is no longer allowed, see
https://savannah.gnu.org/bugs/?56167.
Replacing by
% [PREC,COMPACT] = {[],PREC}{};
PREC = [];
COMPACT = PREC(:);
makes it work but I don't know if that's the right fix.
The next test, 'toJSON(false)' fails elsewhere (L.234) and
toJSON(reshape(1:8,2,2,2)) fails in L.217. Trying to fix those (just entering
":" between curly brackets) gave
"error: '_num2str_' undefined near line 170, column 170"
(I know it's defined on L.86) and then I gave up.
Please fix these issues.
Then,
>> test fromJSON
***** test ## number
assert(fromJSON('4'),4)
!!!!! test failed
invalid use of 'end': may only be used to index existing value
>> fromJSON('4')
error: invalid use of 'end': may only be used to index existing value
error: called from
fromJSON>_fromjson_ at line 70 column 25
fromJSON at line 62 column 9
(perhaps also an Octave-7.0.0 issue)
variable 'obj' needs to be initialized (empty) before it can be indexed with
(end+1).
Also in fromJSON I saw several empty var{} indexing which will error out.
Can you build Octave-7.0.0 to try yourself?
If you're on Linux it shouldn't be too hard, if on Windows I could cross-build
a recent tip for you and upload it somewhere.
I'm on the verge of making a (bug fix) io-2.6.3 release, I really hope you can
delivr toJSON and fromJSON also running in Octave-7+ so that I can include
them in the io package. In fact that's all the release is waiting for.
I hope you can fix all of these issues
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/patch/?9980>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/
- [Octave-patch-tracker] [patch #9980] JSON encoder and decoder, alternative to object2json, anonymous, 2020/10/15
- [Octave-patch-tracker] [patch #9980] JSON encoder and decoder, alternative to object2json, Kai Torben Ohlhus, 2020/10/16
- [Octave-patch-tracker] [patch #9980] JSON encoder and decoder, alternative to object2json, Philip Nienhuis, 2020/10/16
- [Octave-patch-tracker] [patch #9980] JSON encoder and decoder, alternative to object2json, anonymous, 2020/10/16
- [Octave-patch-tracker] [patch #9980] JSON encoder and decoder, alternative to object2json, Kai Torben Ohlhus, 2020/10/16
- [Octave-patch-tracker] [patch #9980] JSON encoder and decoder, alternative to object2json, anonymous, 2020/10/17
- [Octave-patch-tracker] [patch #9980] JSON encoder and decoder, alternative to object2json, Philip Nienhuis, 2020/10/17
- [Octave-patch-tracker] [patch #9980] JSON encoder and decoder, alternative to object2json, anonymous, 2020/10/19
- [Octave-patch-tracker] [patch #9980] JSON encoder and decoder, alternative to object2json, anonymous, 2020/10/24
- [Octave-patch-tracker] [patch #9980] JSON encoder and decoder, alternative to object2json,
Philip Nienhuis <=
- [Octave-patch-tracker] [patch #9980] JSON encoder and decoder, alternative to object2json, anonymous, 2020/10/26
- [Octave-patch-tracker] [patch #9980] JSON encoder and decoder, alternative to object2json, anonymous, 2020/10/26
- [Octave-patch-tracker] [patch #9980] JSON encoder and decoder, alternative to object2json, Kai Torben Ohlhus, 2020/10/26
- [Octave-patch-tracker] [patch #9980] JSON encoder and decoder, alternative to object2json, Philip Nienhuis, 2020/10/27
- [Octave-patch-tracker] [patch #9980] JSON encoder and decoder, alternative to object2json, anonymous, 2020/10/27
- [Octave-patch-tracker] [patch #9980] JSON encoder and decoder, alternative to object2json, John W. Eaton, 2020/10/27
- [Octave-patch-tracker] [patch #9980] JSON encoder and decoder, alternative to object2json, anonymous, 2020/10/27
- [Octave-patch-tracker] [patch #9980] JSON encoder and decoder, alternative to object2json, anonymous, 2020/10/27
- [Octave-patch-tracker] [patch #9980] JSON encoder and decoder, alternative to object2json, John W. Eaton, 2020/10/27
- [Octave-patch-tracker] [patch #9980] JSON encoder and decoder, alternative to object2json, Philip Nienhuis, 2020/10/27