Closed
Bug 208211
Opened 22 years ago
Closed 14 years ago
Implement object call semantics for IDispatch objects: obj(x) for obj.item(x)
Categories
(Core :: XPConnect, enhancement)
Tracking
()
RESOLVED
INVALID
mozilla1.7alpha
People
(Reporter: dbradley, Assigned: dbradley)
References
Details
Microsoft provides some syntatic sugar that allows callers to make a call on a
object. For instance,
if objA had a method foo. And it was considered the default method.
objA("test"); would invoke foo on objA passing test. foo could also be a
property, this often occurs when the object represent a collection of items.
Rather than explicitly saying objA.items(x), MS allows the shorthand objA(x);
Comment 1•22 years ago
|
||
See http://lxr.mozilla.org/mozilla/source/js/src/js.c#1604 for an example of how
to use JS_SetCallReturnValue2 in conjunction with returning an object (typically
the |this| parameter, canonically named |obj| in native JS functions), to return
a reference type (obj, id) where id is |argv[0]|. Such a return type is handled
by getting the value of that property, when the call occurs in an "rvalue"
content; else by setting that reference to a value when the call occurs on the
left-hand side of an assignment operator.
/be
Summary: Implement object call symantics for IDispatch objects: obj(x) for obj.item(x) → Implement object call semantics for IDispatch objects: obj(x) for obj.item(x)
Assignee | ||
Comment 2•22 years ago
|
||
I finally found an example/description in MSDN:
The Fields collection is the default member of the Recordset object. As a
result, the following two code statements are equivalent.
Debug.Print objRs.Fields.Item(0) ' Both statements print
Debug.Print objRs(0) ' the Value of Item(0).
Status: NEW → ASSIGNED
Assignee | ||
Comment 3•22 years ago
|
||
From what I can tell, the key is the dispid which is zero. I've checked several
cases, and this seems to be the common factor, so that's easy enough to check for.
Assignee | ||
Updated•22 years ago
|
Target Milestone: --- → mozilla1.5alpha
Assignee | ||
Updated•22 years ago
|
Target Milestone: mozilla1.5alpha → mozilla1.5beta
Assignee | ||
Comment 4•22 years ago
|
||
Moving out, speak up if you believe this needs to be considered for 1.5b
Target Milestone: mozilla1.5beta → mozilla1.6alpha
Updated•19 years ago
|
QA Contact: pschwartau → xpconnect
Comment 6•14 years ago
|
||
The IDispatch API was removed in bug 662000.
-> INVALID
[Filter bugspam on idispatchinvalid]
Status: ASSIGNED → RESOLVED
Closed: 14 years ago
Resolution: --- → INVALID
You need to log in
before you can comment on or make changes to this bug.
Description
•