Re: [vwrap] ECMA-262 and the Real LLSD type

David W Levine <dwl@us.ibm.com> Thu, 06 May 2010 22:24 UTC

Return-Path: <dwl@us.ibm.com>
X-Original-To: vwrap@core3.amsl.com
Delivered-To: vwrap@core3.amsl.com
Received: from localhost (localhost [127.0.0.1]) by core3.amsl.com (Postfix) with ESMTP id A17DE3A6A16; Thu, 6 May 2010 15:24:20 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.973
X-Spam-Level:
X-Spam-Status: No, score=-2.973 tagged_above=-999 required=5 tests=[AWL=-0.375, BAYES_00=-2.599, HTML_MESSAGE=0.001]
Received: from mail.ietf.org ([64.170.98.32]) by localhost (core3.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id WQXZpRXxuj7w; Thu, 6 May 2010 15:24:16 -0700 (PDT)
Received: from e7.ny.us.ibm.com (e7.ny.us.ibm.com [32.97.182.137]) by core3.amsl.com (Postfix) with ESMTP id 6FC3F3A688C; Thu, 6 May 2010 15:24:06 -0700 (PDT)
Received: from d01relay07.pok.ibm.com (d01relay07.pok.ibm.com [9.56.227.147]) by e7.ny.us.ibm.com (8.14.3/8.13.1) with ESMTP id o46MDimY004919; Thu, 6 May 2010 18:13:44 -0400
Received: from d01av01.pok.ibm.com (d01av01.pok.ibm.com [9.56.224.215]) by d01relay07.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id o46MNq5w2093152; Thu, 6 May 2010 18:23:52 -0400
Received: from d01av01.pok.ibm.com (loopback [127.0.0.1]) by d01av01.pok.ibm.com (8.14.3/8.13.1/NCO v10.0 AVout) with ESMTP id o46MNqHH031257; Thu, 6 May 2010 18:23:52 -0400
Received: from d01ml605.pok.ibm.com (d01ml605.pok.ibm.com [9.56.227.91]) by d01av01.pok.ibm.com (8.14.3/8.13.1/NCO v10.0 AVin) with ESMTP id o46MNqH1031251; Thu, 6 May 2010 18:23:52 -0400
In-Reply-To: <62BFE5680C037E4DA0B0A08946C0933DCE425C2A@rrsmsx506.amr.corp.intel.com>
References: <62BFE5680C037E4DA0B0A08946C0933DCE425A2C@rrsmsx506.amr.corp.intel.com> <z2jb325928b1005061237q9c08d062v25e43996c964839f@mail.gmail.com> <m2xf72742de1005061348h5f0a246doad547c752272fe5@mail.gmail.com> <62BFE5680C037E4DA0B0A08946C0933DCE425C2A@rrsmsx506.amr.corp.intel.com>
To: "Hurliman, John" <john.hurliman@intel.com>
MIME-Version: 1.0
X-KeepSent: B30AB0BD:71074608-8525771B:007AE1F2; type=4; name=$KeepSent
X-Mailer: Lotus Notes Release 8.0.2 HF623 January 16, 2009
Message-ID: <OFB30AB0BD.71074608-ON8525771B.007AE1F2-8525771B.007B06B2@us.ibm.com>
From: David W Levine <dwl@us.ibm.com>
Date: Thu, 06 May 2010 18:23:46 -0400
X-MIMETrack: Serialize by Router on D01ML605/01/M/IBM(Release 8.5.1HF41 | October 22, 2009) at 05/06/2010 18:23:52, Serialize complete at 05/06/2010 18:23:52
Content-Type: multipart/alternative; boundary="=_alternative 007B06AD8525771B_="
Cc: "vwrap@ietf.org" <vwrap@ietf.org>, vwrap-bounces@ietf.org
Subject: Re: [vwrap] ECMA-262 and the Real LLSD type
X-BeenThere: vwrap@ietf.org
X-Mailman-Version: 2.1.9
Precedence: list
List-Id: Virtual World Region Agent Protocol - IETF working group <vwrap.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/listinfo/vwrap>, <mailto:vwrap-request@ietf.org?subject=unsubscribe>
List-Archive: <http://www.ietf.org/mail-archive/web/vwrap>
List-Post: <mailto:vwrap@ietf.org>
List-Help: <mailto:vwrap-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/vwrap>, <mailto:vwrap-request@ietf.org?subject=subscribe>
X-List-Received-Date: Thu, 06 May 2010 22:24:20 -0000

+1 on Joshua's approach. Document the expected asReal coercion and your 
bases are covered nicely I think. 

- David
~ Zha




From:
"Hurliman, John" <john.hurliman@intel.com>
To:
Joshua Bell <josh@lindenlab.com>, "vwrap@ietf.org" <vwrap@ietf.org>
Date:
05/06/2010 04:55 PM
Subject:
Re: [vwrap] ECMA-262 and the Real LLSD type
Sent by:
vwrap-bounces@ietf.org



I’m fine with that approach.
John
 
From: vwrap-bounces@ietf.org [mailto:vwrap-bounces@ietf.org] On Behalf Of 
Joshua Bell
Sent: Thursday, May 06, 2010 1:48 PM
To: vwrap@ietf.org
Subject: Re: [vwrap] ECMA-262 and the Real LLSD type
 
I did some playing in an ECMAScript implementation of LLSD, following 
John's suggestions of serializing NaN, +/- Infinity, and also negative 
zero, as strings when serializing to JSON. Round-tripping works like a 
charm, assuming of course that you're testing the results using an 
"asReal" coercion that follows the same logic, which an LLSD 
implementation should be.
 
Crockford's http://www.json.org/js.html page even hints at this approach 
at the bottom, suggesting that non-finite values could be serialized to 
JSON as strings.
 
On Thu, May 6, 2010 at 12:37 PM, Meadhbh Hamrick <ohmeadhbh@gmail.com> 
wrote:
k. so i pinged doug crockford about it. his response was that JSON
wants to be independent of any floating point standard, and thus only
represents finite numbers.

so... a) it's not a mistake or an oversight that you can't represent
NaNs as JSON-Numbers and b) even if it somehow worked in current
implementations, it's not the intent of the JSON designers, so, it may
not work in the future.

so do we know how important it is to represent each of the distinct
non-finite reals?

-cheers
-meadhbh
--
meadhbh hamrick * it's pronounced "maeve"
@OhMeadhbh * http://meadhbh.org/ * OhMeadhbh@gmail.com



On Thu, May 6, 2010 at 10:36 AM, Hurliman, John <john.hurliman@intel.com> 
wrote:
> In draft-hamrick-llsd-00 "3.2. JSON Serialization" it states:
>
>   Real  LLSD 'Real' values are represented by the JSON non-terminal 
'number'.
>
> Then later in "Appendix A. ABNF of Real Values" it lists a series of 
strings that can be converted into real values:
>
>   negative-infinity =  %x2D.49.6E.66.69,6E.69.74.79   ; "-Infinity"
>   negative-zero     =  %x2D.5A.65.72.6F               ; "-Zero"
>   zero              =  %x30.2E.30                     ; "0.0"
>   positive-zero     =  %x2B.5A.65.72.6F               ; "+Zero"
>   positive-infinity =  %x2B.49.6E.66.69,6E.69.74.79   ; "+Infinity"
>   signaling-nan       =  %4E.61.4E.53                   ; "NaNS"
>   quiet-nan         =  %4E.61.4E.51                   ; "NaNQ"
>
> Does this mean that an LLSD real type with a value of -Infinity needs to 
be converted to a JSON string, and would be decoded on the receiving side 
as an LLSD string with value "-Infinity" (that happens to have a valid 
conversion to an LLSD real)? ECMA-262 does not support Infinity, NaN, etc. 
for the JSON 'number' type so it looks like we need to transmit those 
values as strings.
>
> John
> _______________________________________________
> vwrap mailing list
> vwrap@ietf.org
> https://www.ietf.org/mailman/listinfo/vwrap
>
_______________________________________________
vwrap mailing list
vwrap@ietf.org
https://www.ietf.org/mailman/listinfo/vwrap
 _______________________________________________
vwrap mailing list
vwrap@ietf.org
https://www.ietf.org/mailman/listinfo/vwrap