Re: Re: Removing basic types from our JSON parser
| From: | Rasmus Lerdorf | Date: | Sat, 13 Dec 2008 18:21:53 +0000 |
| Subject: | Re: Re: Removing basic types from our JSON parser | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-42237@lists.php.net to get a copy of this message | ||
Lukas Kahwe Smith wrote:
>
> On 13.12.2008, at 18:59, Ilia Alshanetsky wrote:
>
>>
>> On 12-Dec-08, at 10:50 PM, Scott MacVicar wrote:
>>
>>> Hi All,
>>>
>>> Basic types were added to our JSON decoder to PHP 5.2.1, this allows
>>> one to use json_encode / json_decode on any of our scalar types. Omar
>>> correctly identified #38680 as not a bug but it appears that Ilia
>>> added support for this anyway violating the RFC [1]. Maybe there was
>>> a reason for this but I'm not sure why?
>>
>> PHP is typeless language, IMO its conductive to this design to allow
>> encoding of basic types via json_encode, it reduces the code when
>> communicating to/form JavaScript to avoid type detection. While it
>> does violate the RFC IMO the convenience of the feature is definitely
>> worth it.
>
>
> well seems to me like its safer to stick with RFC as the default. if at
> all this should be optional. JSON is a standard and this requires
> everybody to follow it. so using something else should be a conscious
> decision that is also visible during code review.
I still don't see where in the RFC it says that *only* arrays and
objects can be represented.
I can bring forth the power of Douglas Crockford (who sits next to me at
Yahoo) to put an end to this one on Monday.
-Rasmus