Closed Bug 1618038 Opened 4 years ago Closed 4 years ago

Define inequality operators on wrapper classes in their namespaces, not in the global namespace

Categories

(Core :: JavaScript Engine, task, P2)

task

Tracking

()

RESOLVED FIXED
mozilla76
Tracking Status
firefox76 --- fixed

People

(Reporter: Waldo, Assigned: Waldo)

Details

Attachments

(3 files)

Idiomatic C++ defines operator== and such in the namespace of the arguments, because ADL only looks in the innermost namespace. So if the context of a comparison has any operator== visible in it, it'll shadow the global operator== and you'll get no-valid-overload compile errors. We should do this for our various wrapper classes.

(This will also avoid bz [and everyone else] ever running into this problem again, for code that does comparisons inside namespace mozilla or in a place with a using namespace mozilla; in it. It is a Very Good Use Of Time for everyone to eliminate such recurring sadtimes.)

This gets a bit tricky because our wrapper classes don't all reside in the same namespace, but this is work-aroundable by defining the operators once in one namespace, then using them into each wrapper-enclosing namespace.

If comments fail to adequately clarify the setup here and why it is as it is, tell me and I'll futz with them. :-) This is grody, and saving the next reader time trying to understand stuff is definitely worth it.

Pushed by jwalden@mit.edu:
https://hg.mozilla.org/integration/autoland/rev/2404d662be36
Move |MaybeRooted|, |FakeRooted|, and |FakeMutableHandle| to a fresh header.  r=sfink
https://hg.mozilla.org/integration/autoland/rev/e627b9d49bff
Add some |if constexpr| to eliminate |to{,Mutable}Handle| functions on |FakeRooted|.  r=sfink
Keywords: leave-open
Keywords: leave-open
Pushed by jwalden@mit.edu:
https://hg.mozilla.org/integration/autoland/rev/f6898bd931c5
Implement support for wrapper-class comparisons in the innermost namespace containing each wrapper class, as ADL intended.  Also simplify the operator implementations in certain minor ways.  r=sfink
Attachment #9128978 - Attachment description: Bug 1618038 - Implement support for wrapper-class comparisons in the innermost namespace containing each wrapper class, as ADL intended. Also simplify the operator implementations in certain minor ways. r=sfink → Bug 1618038 - Implement support for wrapper-class comparisons in the innermost namespace containing each wrapper class, as ADL intended. Also simplify the operator implementations in certain minor ways. r=sfink!
Pushed by jwalden@mit.edu:
https://hg.mozilla.org/integration/autoland/rev/b855d9239a65
Implement support for wrapper-class comparisons in the innermost namespace containing each wrapper class, as ADL intended.  Also simplify the operator implementations in certain minor ways.  r=sfink
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla76
Flags: needinfo?(jwalden)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: