Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #14388

Re: Array.prototype.splice implementation in 'JS: The Good Parts'

Path csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!news.internetdienste.de!news.tu-darmstadt.de!news.belwue.de!newsfeed.arcor.de!newsspool3.arcor-online.net!news.arcor.de.POSTED!not-for-mail
Content-Type text/plain; charset="ISO-8859-1"
Message-ID <1600385.oMNUckLgyt@PointedEars.de> (permalink)
From Thomas 'PointedEars' Lahn <PointedEars@web.de>
Reply-To Thomas 'PointedEars' Lahn <cljs@PointedEars.de>
Organization PointedEars Software (PES)
Date Fri, 08 Jun 2012 09:48:25 +0200
User-Agent KNode/4.4.11
Content-Transfer-Encoding 7Bit
X-Face %i>XG-yXR'\"2P/C_aO%~;2o~?g0pPKmbOw^=NT`tprDEf++D.m7"}HW6.#=U:?2GGctkL,f89@H46O$ASoW&?s}.k+&.<b';Md8`dH6iqhT)6C^.Px|[=M@7=Ik[_w<%n1Up"LPQNu2m8|L!/3iby{-]A+#YE}Kl{Cw$\U!kD%K}\2jz"QQP6Uqr],./"?;=4v
Face iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAGFBMVEXTxa4RFk5dUWANED8PFEfy7+MGBiW+n3ZNF/QuAAACaElEQVQ4jVXUwVOcMBQG8Dc7Rc4PUntdWV2uxjDpGaGeozOp1woar4jd5t/v9wLstMwsA/ntlxdCAgUc1hjTc9/JCZfGoo3wG3HdmdAWrIJRHe7GM/TmpY5VFefuVcAkkPbLIaN8rmPmjloyZxgyR3GuJ4K0AGtJ2htz8o7yqikm759fldQXaMpbDzjKAG+8v+AugVTOPO5DOjLvGtUYQwh0CPjnVMyGd+8/GfUB5nLKJDD2aLDh5HYyMDJGDwQIo2ZmZcKbowNmAdB/AzyFhrmF2MHRb0QJJfaAnwGB6orZhoykLzJtGwF/xpYxI1dswomiUj3gTuAIqCn/4C7cULwGNBtwMTk3Y4LfKB5YUaOKBKYtpplm7u0vip8tU1NWWyI/7XdcSuIDoMt6rVHMWT0DbjHPGqDqZVSa6zleLcUTcIKLoMv3ueJluALtAo9B302zPPlrtiVScRdCjXvVh3e3JpYa/jjkuC9N+LrBMlz/eAN4eQijX2EdLo6c5tGGHwLyHFtXk89dDGHwCVhG9T0S/j55AhRZgkMCmUQXJ49TnS1wnQDvw0eAh9ICeMmEFbCnPMFzjAvsWoEWEFdYEx+S0MoUZ1gT1wId8+AF3Bl2OoEu906AUHx5VLw/gXYg/x84loOah/2UYNrgiwSwGO7RfUzVBbx/kgpckumGOi6QirtD6gkLTitbnxNol47S2jVc2vsN5kPqaAHT8uUdAJM4v/DanjYOwmUjWznGfwB7sGtAtor5BgofDuzaRj4kSQAqDakTsKORa3Q3xKi3gE1fhl71KRMqrdZ2AWNNg/YOhQyrVBnb+i+nEg4bsDA+egAAAABJRU5ErkJggg==
Subject Re: Array.prototype.splice implementation in 'JS: The Good Parts'
Newsgroups comp.lang.javascript
References <921eeaac-96e3-440b-b023-20bd8a37f049@d17g2000vbv.googlegroups.com> <9708336.O9o76ZdvQC@PointedEars.de> <63269589-d3ec-42f9-b4eb-9fa98ddef243@p13g2000yqk.googlegroups.com>
Followup-To comp.lang.javascript
MIME-Version 1.0
Lines 52
NNTP-Posting-Date 08 Jun 2012 09:48:26 CEST
NNTP-Posting-Host 5ba25a74.newsspool4.arcor-online.net
X-Trace DXC=KD68\E=Jd3ZI?44J>Z[:RQ4IUK<Cl32<Q4Fo<]lROoRQ8kF<OcfhCO[I43oL[SkIc^DZm8W4\YJN\UFDj8T]K0?SDmniOZG;K0[cI=RG?kUZg]
X-Complaints-To usenet-abuse@arcor.de
Xref csiph.com comp.lang.javascript:14388

Followups directed to: comp.lang.javascript

Show key headers only | View raw


Jun Woong wrote:

> Thomas 'PointedEars' Lahn <PointedE...@web.de> wrote:
>> Jun Woong wrote:
>> > What does the ECMA standard says about this?
>>
>> <http://ecma-international.org/ecma-262/5.1/#sec-15.4.4>:
>>
>> [...]
>> | b. Let fromPresent be the result of calling the [[HasProperty]]
>> | internal method of O with argument from.
>>
>> var fromPresent = from in O;
>>
>> This is the step in the algorithm where apparently both Crockford and V8
>> are wrong, according to the 5.1 Edition and earlier Editions.  Crockford
>> does not consider `undefined' values for elements, and V8 does not
>> consider uninitialized elements (here: those with indexes 0 and 1).
> 
> Thus, if `a' is intialized as [undefined, undefined, 0] (having all
> elements initialized), the length of the result should be 2, while it
> should be 0 when initialized as [,, 0] (having uninitialized
> elements).

Yes, exactly.  (That 

  var a = [,, 0];

is equivalent to

  var a = [];
  a[2] = 0;

follows from section "11.1.4 Array Initialiser".)

> Thank you very much for the kind explanation and the nice work that
> the link below leads to.
> 
>> ___
>> [1] <http://PointedEars.de/es-matrix>

You are welcome.  (Stay tuned.)


Regards,

PointedEars
-- 
Use any version of Microsoft Frontpage to create your site.
(This won't prevent people from viewing your source, but no one
will want to steal it.)
  -- from <http://www.vortex-webdesign.com/help/hidesource.htm> (404-comp.)

Back to comp.lang.javascript | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

Array.splice implementation in 'JS: The Good Parts' Jun Woong <woong@icu.ac.kr> - 2012-06-06 21:17 -0700
  Array.prototype.splice implementation in 'JS: The Good Parts' (was: Array.splice implementation in 'JS: The Good Parts') Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-06-07 20:17 +0200
    Re: Array.prototype.splice implementation in 'JS: The Good Parts' (was: Array.splice implementation in 'JS: The Good Parts') Jun Woong <woong@icu.ac.kr> - 2012-06-07 18:41 -0700
      Re: Array.prototype.splice implementation in 'JS: The Good Parts' Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-06-08 09:48 +0200

csiph-web