ES Decimal Status

Michael Michael at lanex.com
Wed Sep 24 13:40:38 PDT 2008


Sorry about that. For some reason I misread the post as stating that they
did not refer to the same property (Hence showing an example that in fact
they did)

 

From: es-discuss-bounces at mozilla.org [mailto:es-discuss-bounces at mozilla.org]
On Behalf Of Brendan Eich
Sent: Wednesday, September 24, 2008 10:56 AM
To: Michael
Cc: es-discuss at mozilla.org
Subject: Re: ES Decimal Status

 

On Sep 24, 2008, at 8:41 AM, Michael wrote:





Maciej wrote:

"I'm not sure what you are getting at. a[1] and a[1.000] refer to the  

same property in ECMAScript, but a[1m] and a[1.000m] would not. Are  

you saying this isn't a problem?"

This is not quite true as you can see here:

var a = [];

a[1] = "foo";

a[1.00] = "bar";

 

WScript.Echo("length: "+a.length + "\n["+ a.join()+"]")

--------------------------------------------

length: 2

[,bar]

 

This shows that a[1] and a[1.00] refer to the same property as Maciej said
(a[1.000] also refers to a[1]).

 

What "This" did you mean "is not quite true"?

 

The issue is not how a value is spelled using a literal. It's that decimal
as proposed remembers its "scale" based on its spelling, and scale affects
toString() result. That's different from the case with number (double) in JS
today.

 

/be

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.mozilla.org/pipermail/es-discuss/attachments/20080924/cf93474c/attachment-0001.html 


More information about the Es-discuss mailing list