From 5004614ab0dbb204800755fd083f84ed8feab576 Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Tue, 6 Jan 2009 12:45:27 -0500 Subject: [PATCH] Add comment about 'new' to HACKING --- HACKING | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/HACKING b/HACKING index 9a468b93..83f8ef35 100644 --- a/HACKING +++ b/HACKING @@ -98,6 +98,17 @@ We try to be quite consistent, but of course, that's not always possible. The exceptions to this rule are for objects with __iterator__ set, and for XML objects (see README.E4X). +* Avoid using 'new' with constructors where possible, and use [] and + {} rather than new Array/new Object. + Right: + RegExp("^" + foo + "$") + Function(code) + new Date + Wrong: + new RegExp("^" + foo + "$") + new Function(code) + Date() // Right if you want a string-representation of the date + == Testing/Optimization == TODO: Add some information here about testing/validation/etc.