From 850722d335424a0f561cad0e964250761ce5d521 Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Tue, 6 Jan 2009 11:48:29 -0500 Subject: [PATCH] Add to HACKING --- HACKING | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/HACKING b/HACKING index a3e7ea77..9a468b93 100644 --- a/HACKING +++ b/HACKING @@ -85,6 +85,19 @@ We try to be quite consistent, but of course, that's not always possible. * Use UNIX new lines (\n), not windows (\r\n) or old Mac ones (\r) +* Use Iterators, Array#forEach, or for (let i = 0; i < ary.length; i++) + to iterate over arrays. for (let i in ary) and for each (let i in ary) + include members in an Array.prototype, which some extensions alter. + Right: + for (let [,elem] in Iterator(ary)) + for (let [k, v] in Iterator(obj)) + ary.forEach(function (elem) { ... + Wrong: + for each (let elem in ary) + + The exceptions to this rule are for objects with __iterator__ set, + and for XML objects (see README.E4X). + == Testing/Optimization == TODO: Add some information here about testing/validation/etc.