develooper Front page | perl.perl5.porters | Postings from December 2021

Re: Pre-RFC: `unknown` versus `undef`

Thread Previous | Thread Next
Darren Duncan
December 19, 2021 01:30
Re: Pre-RFC: `unknown` versus `undef`
Message ID:
Another implication we also have to think about how this would affect 
interchange with other languages or serialization formats.

In particular, JSON has "null".

Before this proposal, it seemed fairly clear cut that a Perl "undef" would map 
to JSON "null" bi-directionally and losslessly.

So if we also have "unknown", then what would a JSON "null" map to on importing 
from JSON, and would both "undef" and "unknown" map to null on exporting to JSON?

I would suggest that both "unknown" and "undef" map to null when exporting to 
JSON, and that when importing from JSON there is a configuration option to the 
importer that says whether to use "unknown" or "undef".

-- Darren Duncan

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About