Closed
Bug 341181
Opened 18 years ago
Closed 11 years ago
nsTArray Length()/Count() issue
Categories
(Core :: XPCOM, defect)
Tracking
()
RESOLVED
DUPLICATE
of bug 493711
People
(Reporter: bzbarsky, Unassigned)
Details
It looks like nsTArray has Length() where every single other array class we have has Count(). Could we either add Count() to nsTArray or replace Length() with Count()?
Comment 1•18 years ago
|
||
I think you are referring to nsCOMArray and nsVoidArray, right? We also have nsString::Length(), NS_ARRAY_LENGTH, and JS Array's ".length" property. I considered making nsTArray have a Count() method that returns PRInt32 like nsVoidArray, but I preferred 'PRUint32 Length()' because I think it's a better name. What problem(s) does the method name cause?
Reporter | ||
Comment 2•18 years ago
|
||
> I think you are referring to nsCOMArray and nsVoidArray, right? And various derivatives of nsVoidArray, yeah. > What problem(s) does the method name cause? Confusion when working with several arrays at once -- you have to keep very careful track of the exact type of each array if you're going to have a prayer of compiling.... So mostly just a time-and-brainprint sink.
Comment 3•18 years ago
|
||
Adding Length() methods to nsVoidArray and nsCOMArray is the other choice. At some point, we should re-implement those in terms of nsTArray anyways, and at that time it might make sense to revise their APIs.
Reporter | ||
Comment 4•18 years ago
|
||
Implementing those in terms of nsTArray would have to be done pretty carefully; I suspect nsTArray has much bigger codesize... But yes, we could add Length() to the other array classes. I'm all for it. As long as _something_ works for all our arrays. ;)
Updated•18 years ago
|
Summary: nsTArray Lenth()/Count() issue → nsTArray Length()/Count() issue
Updated•11 years ago
|
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → DUPLICATE
You need to log in
before you can comment on or make changes to this bug.
Description
•