Closed Bug 597574 Opened 14 years ago Closed 14 years ago

GetPropertyNames and friends should not take outparams by reference

Categories

(Core :: JavaScript Engine, defect)

x86_64
Linux
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: jimb, Unassigned)

References

Details

(Whiteboard: [fixed-in-tracemonkey])

Attachments

(1 file)

When a function takes an out-parameter by reference, it makes it harder to see where things are being modified at call sites. SpiderMonkey has a policy of passing outparams by address. GetPropertyNames and the various function templates that implement it do not follow this convention.

The new 'fix' js::ObjectOps member for bug 492849 should not propagate this error.
Attachment #476412 - Flags: review?(brendan)
Blocks: 492849
Comment on attachment 476412 [details] [diff] [review]
Change GetPropertyNames to take its out-parameter by address, not by non-const reference.

Thanks, for some reason I let this pass, even though I'm the grumpy grandpa of "non-const-refs for out/inout params considered harmful". Gotta stay grumpy!

/be
Attachment #476412 - Flags: review?(brendan) → review+
Nothing grumpy about it. For what it's worth, that convention is part of the Google C++ style as well. Pretty operator-overloading-based domain-specific languages are perhaps an exception.
When I first loaded cfront 0.9 off magtape in 1985, it was clear that operators (complex, the canonical example) were the strong motivation for mutable reference parameters.

/be
Whiteboard: [fixed-in-tracemonkey]
http://hg.mozilla.org/mozilla-central/rev/118c067aa766
Status: NEW → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: