summaryrefslogtreecommitdiffstats
path: root/generic/tclOOScript.h
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2018-07-06 13:50:54 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2018-07-06 13:50:54 (GMT)
commit969f9f571cda6f6b8db32f8b9cdf922715b37c43 (patch)
treeedea7e82d38a056697016644cde74a2afaaaf853 /generic/tclOOScript.h
parent414bcee273fa2ac3fbc1e329f65d1ae7396a22a4 (diff)
downloadtcl-969f9f571cda6f6b8db32f8b9cdf922715b37c43.zip
tcl-969f9f571cda6f6b8db32f8b9cdf922715b37c43.tar.gz
tcl-969f9f571cda6f6b8db32f8b9cdf922715b37c43.tar.bz2
Improving the singleton
Diffstat (limited to 'generic/tclOOScript.h')
-rw-r--r--generic/tclOOScript.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/generic/tclOOScript.h b/generic/tclOOScript.h
index 237bff5..d96ee76 100644
--- a/generic/tclOOScript.h
+++ b/generic/tclOOScript.h
@@ -161,7 +161,12 @@ static const char *tclOOSetupScript =
" method new args {\n"
" if {![info exists object] || ![info object isa object $object]} {\n"
" set object [next {*}$args]\n"
-" ::oo::objdefine $object unexport destroy\n"
+" ::oo::objdefine $object method destroy {} {\n"
+" return -code error {may not destroy a singleton object}\n"
+" }\n"
+" ::oo::objdefine $object method <cloned> {originObject} {\n"
+" return -code error {may not clone a singleton object}\n"
+" }\n"
" }\n"
" return $object\n"
" }\n"