Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #23537
| Path | csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!ecngs!feeder2.ecngs.de!217.188.199.168.MISMATCH!takemy.news.telefonica.de!telefonica.de!newsfeed.arcor.de!newsspool2.arcor-online.net!news.arcor.de.POSTED!not-for-mail |
|---|---|
| Content-Type | text/plain; charset="UTF-8" |
| Message-ID | <1406720.0V7e0g0dhT@PointedEars.de> (permalink) |
| From | Thomas 'PointedEars' Lahn <PointedEars@web.de> |
| Reply-To | Thomas 'PointedEars' Lahn <cljs@PointedEars.de> |
| Organization | PointedEars Software (PES) |
| Date | Tue, 11 Mar 2014 20:32:21 +0100 |
| User-Agent | KNode/4.11.5 |
| Content-Transfer-Encoding | 8Bit |
| 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: arr.push(obj); |
| Newsgroups | comp.lang.javascript |
| References | <b766bb8c-c9a9-4914-bf16-fe342ef06930@googlegroups.com> <XnsA2ED695A14973eejj99@194.109.133.133> <868d8999-f1b7-49bb-a33c-4e76b00ecafa@googlegroups.com> <XnsA2ED8F0737DBBeejj99@194.109.133.133> <fbd15953-edfd-4456-b4c8-7b31417ecd24@googlegroups.com> <531f2b05$0$6660$9b4e6d93@newsspool2.arcor-online.net> <60636642.clnVRmuXiz@PointedEars.de> <531f52ab$0$6670$9b4e6d93@newsspool2.arcor-online.net> |
| MIME-Version | 1.0 |
| Lines | 62 |
| NNTP-Posting-Date | 11 Mar 2014 20:32:25 CET |
| NNTP-Posting-Host | 5b876199.newsspool1.arcor-online.net |
| X-Trace | DXC=5L=BV_ElIGIC4i^e1BZ=_Hic==]BZ:afN4Fo<]lROoRAnkgeX?EC@@@c43BI^Y;R1GDZm8W4\YJNLYUVHKH;GI^G<_e=dZX<SRGMm9Q[4BI]nC |
| X-Complaints-To | usenet-abuse@arcor.de |
| Xref | csiph.com comp.lang.javascript:23537 |
Show key headers only | View raw
Christoph Michael Becker wrote: > Thomas 'PointedEars' Lahn wrote: >> Christoph Michael Becker wrote: >>> I suggest to use ECMAScript Arrays the way they're meant to be used, and >>> use indexes from 0 to n, and scale them as appropriate. >> >> As long as the “length” property is not used directly, it can be useful >> to have an *Array* instance with user-defined properties whose names are >> string representations of negative numbers, positive numbers greater than >> 2³² − 1, and non-integers. > > While you're surely right that having "non negative" properties *can* be > useful sometimes, it might often be confusing (particularly for > beginners). Non sequitur. I expect people to use their brain while programming, IOW not to treat those special arrays as if they were ordinary arrays. > Not only the length property will not work as "expected", Depends on the implementation. You are forgetting getters. > but also several of the methods of Array.prototype, e.g. shift() and > unshift(). You could override them. > One does not have to use these, but than one could even use > an object that does not "inherit" from Array at all. But it makes sense to have an object that works like an Array in all other respects. Many Array prototype methods are intentionally generic. <http://PointedEars.de/es-matrix?filter=Array.prototype> > Element access via the bracket notation as well as for loops will work on > such "arrays". Depends on the implementation, see jsx.array.BigArray in <http://PointedEars.de/wsvn/JSX/trunk/array.js>. I have written this to increase the upper border for indexes (from the getPrimes() discussion), and index < 0 gets you the same as in Python (with the bracket property accessor: only if Proxy is supported). But now I am thinking of a property defining whether you can have negative indexes on the object, modifying that behavior slightly. FWIW, the “length” property could then yield the difference between the maximum positive and the minimum negative index or just the maximum positive index + 1 as it always had; how did you get the idea that “for” loops would stop working for those objects *per se*? > Quite fascinating! :) Indeed. -- PointedEars FAQ: <http://PointedEars.de/faq> | SVN: <http://PointedEars.de/wsvn/> Twitter: @PointedEars2 | ES Matrix: <http://PointedEars.de/es-matrix> Please do not Cc: me. / Bitte keine Kopien per E-Mail.
Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
arr.push(obj); jonas.thornvall@gmail.com - 2014-03-10 17:38 -0700
Re: arr.push(obj); jonas.thornvall@gmail.com - 2014-03-10 20:19 -0700
Re: arr.push(obj); jonas.thornvall@gmail.com - 2014-03-10 20:28 -0700
Re: arr.push(obj); jonas.thornvall@gmail.com - 2014-03-10 21:19 -0700
Re: arr.push(obj); Joao Rodrigues <groups_jr-1@yahoo.com.br> - 2014-03-11 06:59 -0300
Re: arr.push(obj); Christoph Michael Becker <cmbecker69@arcor.de> - 2014-03-11 16:02 +0100
Re: arr.push(obj); Ben Bacarisse <ben.usenet@bsb.me.uk> - 2014-03-11 16:22 +0000
Re: arr.push(obj); Joao Rodrigues <groups_jr-1@yahoo.com.br> - 2014-03-11 13:32 -0300
Re: arr.push(obj); "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2014-03-11 10:21 +0100
Re: arr.push(obj); jonas.thornvall@gmail.com - 2014-03-11 03:53 -0700
Re: arr.push(obj); "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2014-03-11 14:03 +0100
Re: arr.push(obj); jonas.thornvall@gmail.com - 2014-03-11 07:45 -0700
Re: arr.push(obj); "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2014-03-11 16:24 +0100
Re: arr.push(obj); jonas.thornvall@gmail.com - 2014-03-11 10:40 -0700
Re: arr.push(obj); jonas.thornvall@gmail.com - 2014-03-11 10:51 -0700
Re: arr.push(obj); Christoph Michael Becker <cmbecker69@arcor.de> - 2014-03-11 19:23 +0100
Re: arr.push(obj); jonas.thornvall@gmail.com - 2014-03-11 15:33 -0700
Re: arr.push(obj); "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2014-03-12 00:37 +0100
Re: arr.push(obj); jonas.thornvall@gmail.com - 2014-03-11 16:46 -0700
Re: arr.push(obj); "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2014-03-12 01:05 +0100
Re: arr.push(obj); Christoph Michael Becker <cmbecker69@arcor.de> - 2014-03-12 01:40 +0100
Re: arr.push(obj); Christoph Michael Becker <cmbecker69@arcor.de> - 2014-03-12 00:48 +0100
Re: arr.push(obj); jonas.thornvall@gmail.com - 2014-03-11 15:43 -0700
Re: arr.push(obj); jonas.thornvall@gmail.com - 2014-03-11 16:18 -0700
Re: arr.push(obj); "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2014-03-12 00:39 +0100
Re: arr.push(obj); Christoph Michael Becker <cmbecker69@arcor.de> - 2014-03-12 00:52 +0100
Re: arr.push(obj); Christoph Michael Becker <cmbecker69@arcor.de> - 2014-03-12 00:49 +0100
Re: arr.push(obj); jonas.thornvall@gmail.com - 2014-03-11 17:16 -0700
Re: arr.push(obj); Christoph Michael Becker <cmbecker69@arcor.de> - 2014-03-12 02:07 +0100
Re: arr.push(obj); jonas.thornvall@gmail.com - 2014-03-11 18:13 -0700
Re: arr.push(obj); Christoph Michael Becker <cmbecker69@arcor.de> - 2014-03-13 02:25 +0100
Re: arr.push(obj); Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2014-03-13 11:03 +0100
Re: arr.push(obj); jonas.thornvall@gmail.com - 2014-03-12 07:46 -0700
Re: arr.push(obj); Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2014-03-12 01:27 +0100
Re: arr.push(obj); Christoph Michael Becker <cmbecker69@arcor.de> - 2014-03-12 01:44 +0100
Re: arr.push(obj); Christoph Michael Becker <cmbecker69@arcor.de> - 2014-03-11 16:26 +0100
Re: arr.push(obj); Carlos Pedro <carlospedr@gmail.com> - 2014-03-11 09:21 -0700
Re: arr.push(obj); Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2014-03-11 18:01 +0100
Re: arr.push(obj); Christoph Michael Becker <cmbecker69@arcor.de> - 2014-03-11 19:15 +0100
Re: arr.push(obj); Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2014-03-11 20:32 +0100
Re: arr.push(obj); Christoph Michael Becker <cmbecker69@arcor.de> - 2014-03-12 01:01 +0100
Re: arr.push(obj); Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2014-03-12 04:08 +0100
Re: arr.push(obj); Christoph Michael Becker <cmbecker69@arcor.de> - 2014-03-12 18:00 +0100
Re: arr.push(obj); Joao Rodrigues <groups_jr-1@yahoo.com.br> - 2014-03-11 06:24 -0300
Re: arr.push(obj); jonas.thornvall@gmail.com - 2014-03-11 03:47 -0700
Re: arr.push(obj); Ben Bacarisse <ben.usenet@bsb.me.uk> - 2014-03-11 15:19 +0000
csiph-web