JSON decoding

Brendan Eich brendan at mozilla.com
Wed Oct 25 07:05:07 PDT 2006


On Oct 25, 2006, at 7:24 AM, Dave Herman wrote:

>> I thought you might mean that, but I don't see how to do it.  We  
>> can't declare a type for "the set of all valid JSON values".  If  
>> we take an
>
> Do we need to? If you can't detect it statically or express it as a  
> type, you can still detect it dynamically.

Sure, and that's what Bob is proposing. We just didn't see it last  
week at the face to face. The built-in encoder must produce a string,  
but the customizable method can produce only a JSON value, instead of  
producing an encoded substring that would then have to be validated  
by parsing.  Then the encoder can check the value for cycles, do  
standard stuff like pretty encoding, etc.

Doug, what do you think?

/be




More information about the Es4-discuss mailing list