JSON anomaly with ⎕DF Display Form

General APL language issues

JSON anomaly with ⎕DF Display Form

Postby petermsiegel on Sun Oct 20, 2019 12:14 am

This is a bit odd. (Though I can guess what's going on, I won't).
Changing a display form for a simple JSON object adds a phantom entry in ⎕JSON calls to view object.
Code: Select all
        )reset
       a←⎕JSON '{"red":0,"orange":1}'
       a.⎕DF 'display form'
       a.⎕NL -⍳12                   ⍝ Looks good
┌──────┬───┐
│orange│red│
└──────┴───┘
⍝ A new field with an unusual name appears holding the ⎕DF (display form) value.
        ⎕JSON⍠'D'⊣a                ⍝ Default (⍠'D') and ⍠'M' both show oddity!
{"orange":1,"red":0,"ᐐཫ\u0001":"display form"}  ⍝ internal magic ==> unicode?
       a.⎕NL -⍳12                  ⍝ Still looks good
┌──────┬───┐
│orange│red│
└──────┴───┘
       ⎕←a.⎕DF ''                  ⍝ We nulled out the ⎕DF for the object.
display form
       ⎕JSON⍠'D'⊣a                 ⍝ Odd display form (⎕DF) rogue entry still here!!!
{"orange":1,"red":0,"ᐐཫ\u0001":""}     
petermsiegel
 
Posts: 69
Joined: Thu Nov 11, 2010 11:04 pm

Re: JSON anomaly with ⎕DF Display Form

Postby Richard|Dyalog on Mon Oct 21, 2019 4:51 pm

The namespace display form should not have been exposed by ⎕JSON at all. That has been fixed in the development interpreter (18.0) but not earlier versions; the reference for the fix is Mantis 16644.

I will reopen that issue to get the fix ported to all supported versions.
User avatar
Richard|Dyalog
 
Posts: 41
Joined: Thu Oct 02, 2008 11:11 am

Re: JSON anomaly with ⎕DF Display Form

Postby petermsiegel on Tue Oct 22, 2019 3:49 am

I was so much looking forward to using the "Unified Canadian aboriginal syllabics" character (UCS 5136), aka the "Wii" Emoji, in all my programs!
petermsiegel
 
Posts: 69
Joined: Thu Nov 11, 2010 11:04 pm

Re: JSON anomaly with ⎕DF Display Form

Postby Richard|Dyalog on Thu Dec 19, 2019 5:03 pm

After some investigation I have elected not to patch the earlier versions. The potential to destabilise the current release has to be taken into account and compared against the severity of the issue being resolved - and in this case the fix is non-trivial and not easily back-ported, and the issue is relatively minor.

There is a workround (don't set the display form) - but if anyone feels the problem is critical we can reconsider.
User avatar
Richard|Dyalog
 
Posts: 41
Joined: Thu Oct 02, 2008 11:11 am


Return to Language

Who is online

Users browsing this forum: No registered users and 1 guest