mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2026-03-22 22:53:32 +01:00
Add comment about 'new' to HACKING
This commit is contained in:
11
HACKING
11
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,
|
The exceptions to this rule are for objects with __iterator__ set,
|
||||||
and for XML objects (see README.E4X).
|
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 ==
|
== Testing/Optimization ==
|
||||||
|
|
||||||
TODO: Add some information here about testing/validation/etc.
|
TODO: Add some information here about testing/validation/etc.
|
||||||
|
|||||||
Reference in New Issue
Block a user