summaryrefslogtreecommitdiffstats
path: root/doc/Method.3
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2021-04-25 20:22:05 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2021-04-25 20:22:05 (GMT)
commit42a77f7b4b1e4f3699d71cd2cf9fe6de7e9e4d71 (patch)
tree082b18aae06a09a552884b3359810f4eb748b1d9 /doc/Method.3
parent5a5cb4c044353add5cfbc502d8fdfb34d4410af6 (diff)
parent9bf722e8da25eb28ed58fe97f941f4badaa3af36 (diff)
downloadtcl-42a77f7b4b1e4f3699d71cd2cf9fe6de7e9e4d71.zip
tcl-42a77f7b4b1e4f3699d71cd2cf9fe6de7e9e4d71.tar.gz
tcl-42a77f7b4b1e4f3699d71cd2cf9fe6de7e9e4d71.tar.bz2
Document our reference count management
Diffstat (limited to 'doc/Method.3')
-rw-r--r--doc/Method.326
1 files changed, 25 insertions, 1 deletions
diff --git a/doc/Method.3 b/doc/Method.3
index 9e636a1..577cd54 100644
--- a/doc/Method.3
+++ b/doc/Method.3
@@ -258,8 +258,32 @@ also return TCL_ERROR; it should return TCL_OK otherwise.
The \fIoldClientData\fR field to a Tcl_CloneProc gives the value from the
method being copied from, and the \fInewClientDataPtr\fR field will point to
a variable in which to write the value for the method being copied to.
+.SH "REFERENCE COUNT MANAGEMENT"
+.PP
+The \fInameObj\fR argument to \fBTcl_NewMethod\fR and
+\fBTcl_NewInstanceMethod\fR (when non-NULL) will have its reference count
+incremented if there is no existing method with that name in that
+class/object.
+.PP
+The result of \fBTcl_MethodName\fR is a value with a reference count of at
+least one. It should not be modified without first duplicating it (with
+\fBTcl_DuplicateObj\fR).
+.PP
+The values in the first \fIobjc\fR values of the \fIobjv\fR argument to
+\fBTcl_ObjectContextInvokeNext\fR are assumed to have a reference count of at
+least 1; the containing array is assumed to endure until the next method
+implementation (see \fBnext\fR) returns. Be aware that methods may
+\fByield\fR; if any post-call actions are desired (e.g., decrementing the
+reference count of values passed in here), they must be scheduled with
+\fBTcl_NRAddCallback\fR.
+.PP
+The \fIcallProc\fR of the \fBTcl_MethodType\fR structure takes values of at
+least reference count 1 in its \fIobjv\fR argument. It may add its own
+references, but must not decrement the reference count below that level; the
+caller of the method will decrement the reference count once the method
+returns properly (and the reference will be held if the method \fByield\fRs).
.SH "SEE ALSO"
-Class(3), oo::class(n), oo::define(n), oo::object(n)
+Class(3), NRE(3), oo::class(n), oo::define(n), oo::object(n)
.SH KEYWORDS
constructor, method, object