Closed
Bug 584082
Opened 14 years ago
Closed 14 years ago
Narcissus: eliminate uses of ==
Categories
(Other Applications Graveyard :: Narcissus, defect)
Tracking
(Not tracked)
RESOLVED
FIXED
People
(Reporter: dherman, Assigned: dherman)
References
Details
Attachments
(1 file, 1 obsolete file)
54.70 KB,
patch
|
pcwalton
:
review+
|
Details | Diff | Splinter Review |
We should use ===, which is clearer and less error-masking than ==, everywhere in the Narcissus codebase. Dave
Comment 1•14 years ago
|
||
Channeling crock, or just running JSLint? I intentionally use == where types are the same, since it's equivalent to ===. But maybe this is too fragile -- is there a bug? /be
Assignee | ||
Comment 2•14 years ago
|
||
I agree with crock on this one, but not necessarily because it lets me tut-tut about JavaScript. It's just that, if we aren't using the extra functionality of ==, it's misleading to the reader -- why use the more powerful operation when you aren't using its power? Principle of least power or whatever you call it. Dave
Comment 3•14 years ago
|
||
(South Park voice:) They got Dave -- bastards! ;-) /be
Assignee | ||
Comment 4•14 years ago
|
||
I'll take the ribbing, but seriously: DWIM is rarely WIM, and if you don't even intend to be using it, you're taking the risk of silently masking bugs. No need to raise the spooky spectre of security, it's just better preparation for when bugs happen. Dave
Assignee | ||
Updated•14 years ago
|
Assignee: general → nobody
Component: JavaScript Engine → Narcissus
Product: Core → Other Applications
QA Contact: general → narcissus
Assignee | ||
Comment 5•14 years ago
|
||
This patch eliminates all uses of == and != except for the part where the evaluator is interpreting those operators. There's a spot where the original code used |== null| to check for either null or undefined, and I've replaced that with the more explicit two checks, using ===. Dave
Assignee: nobody → dherman
Attachment #463743 -
Flags: review?(pwalton)
Comment 6•14 years ago
|
||
r=me Note that I prefer "foo == null" to "foo === null || foo === undefined", but I don't have really strong opinions either way.
Updated•14 years ago
|
Attachment #463743 -
Flags: review?(pwalton) → review+
Assignee | ||
Comment 7•14 years ago
|
||
http://hg.mozilla.org/tracemonkey/rev/015059c45596
Assignee | ||
Updated•14 years ago
|
Status: NEW → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
Comment 8•14 years ago
|
||
(In reply to comment #6) > r=me > > Note that I prefer "foo == null" to "foo === null || foo === undefined", but I > don't have really strong opinions either way. Yeah, this is another case where I used == intentionally (and still will in my own JS hacking). Slightly more economical and efficient, but maybe confusing to JS hackers who don't know the mysteries of ==, or who would prefer to forget. /be
Comment 9•14 years ago
|
||
Attachment #465439 -
Flags: review?(pwalton)
Comment 10•14 years ago
|
||
Missed one! Patch attached.
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Comment 11•14 years ago
|
||
Best to file a followup bug, or just fix it without a bug if you are cheeky. Reopening when there was not a back-out makes for a confusing audit trail. /be
Comment 12•14 years ago
|
||
Sorry, didn't know about that protocol. WIll open a new bug.
Status: REOPENED → RESOLVED
Closed: 14 years ago → 14 years ago
Resolution: --- → FIXED
Updated•14 years ago
|
Attachment #465439 -
Attachment is obsolete: true
Attachment #465439 -
Flags: review?(pwalton)
Updated•5 years ago
|
Product: Other Applications → Other Applications Graveyard
You need to log in
before you can comment on or make changes to this bug.
Description
•