Arc Forumnew | comments | leaders | submitlogin
2 points by rocketnia 4504 days ago | link | parent

"the JSON RFC (https://tools.ietf.org/html/rfc4627) "

Ah, I get to learn a few new things about JSON! JSON strings are limited to valid Unicode characters, and "A JSON text is a serialized object or array," not a number, a boolean, or null. All this time I thought these were just common misconceptions! XD

It turns out my own misconceptions about JSON are based on ECMAScript 5.

To start, ECMAScript 5 is very specific about the fact that ECMAScript strings are arbitrary sequences of unsigned 16-bit values.

  4.3.16
  String value
  primitive value that is a finite ordered sequence of zero or more
  16-bit unsigned integer
  
  NOTE A String value is a member of the String type. Each integer
  value in the sequence usually represents a single 16-bit unit of
  UTF-16 text. However, ECMAScript does not place any restrictions or
  requirements on the values except that they must be 16-bit unsigned
  integers.
ECMAScript 5's specification of JSON.parse and JSON.stringify explicitly calls out the JSON spec, but then it relaxes the constraint that the top level of the value must be an object or array, and it subtly (maybe too subtly) relaxes the constraint that the strings must contain valid Unicode: It says "The JSON interchange format used in this specification is exactly that described by RFC 4627 with two exceptions," and one of those exceptions is that conforming implentations of ECMAScript 5 aren't allowed to implement their own extensions to the JSON format, and must instead use exactly the format defined by ECMAScript 5. As it happens, the formal JSON grammar defined by ECMAScript 5 supports invalid Unicode.

---

"This follows naturally if you assume that empty strings aren't included in the list."

I'm not most people, but when the Nuit spec says "Anything between the @ and the first whitespace character is the first element of the list," I don't see a reason to make "@ " a special case that means something different.



1 point by Pauan 4504 days ago | link

"I'm not most people, but when the Nuit spec says "Anything between the @ and the first whitespace character is the first element of the list," I don't see a reason to make "@ " a special case that means something different."

Then I'll change the spec to be more understandable. What wording would you prefer?

-----

2 points by rocketnia 4503 days ago | link

I'll try to make it a minimal change: "If there's anything between the @ and the first whitespace character, that intervening string is the first element of the list."

-----

1 point by Pauan 4503 days ago | link

That sounds great! I'll put in something like that, and also explain about the implicit list.

-----