Index: generic/gentclAPI.decls =================================================================== diff -u -r142687efa93af981936db61ecfde494d8f269b0a -r2f283277aff2bb9488419a4fbe2442a5b17546e5 --- generic/gentclAPI.decls (.../gentclAPI.decls) (revision 142687efa93af981936db61ecfde494d8f269b0a) +++ generic/gentclAPI.decls (.../gentclAPI.decls) (revision 2f283277aff2bb9488419a4fbe2442a5b17546e5) @@ -64,7 +64,7 @@ {-argName "object" -required 1 -type object} {-argName "methodName" -required 1 -type tclobj} {-argName "-per-object"} - {-argName "methodproperty" -required 1 -type "protected|public|static|slotobj"} + {-argName "methodproperty" -required 1 -type "protected|redefine-protected|slotobj"} {-argName "value" -type tclobj} } xotclCmd my XOTclMyCmd { Index: generic/predefined.h =================================================================== diff -u -r142687efa93af981936db61ecfde494d8f269b0a -r2f283277aff2bb9488419a4fbe2442a5b17546e5 --- generic/predefined.h (.../predefined.h) (revision 142687efa93af981936db61ecfde494d8f269b0a) +++ generic/predefined.h (.../predefined.h) (revision 2f283277aff2bb9488419a4fbe2442a5b17546e5) @@ -16,10 +16,10 @@ "::xotcl::methodproperty Object $cmd protected 1}\n" "foreach cmd [list recreate] {\n" "::xotcl::methodproperty Class $cmd protected 1}\n" -"::xotcl::methodproperty Object destroy static true\n" -"::xotcl::methodproperty Class alloc static true\n" -"::xotcl::methodproperty Class dealloc static true\n" -"::xotcl::methodproperty Class create static true\n" +"::xotcl::methodproperty Object destroy redefine-protected true\n" +"::xotcl::methodproperty Class alloc redefine-protected true\n" +"::xotcl::methodproperty Class dealloc redefine-protected true\n" +"::xotcl::methodproperty Class create redefine-protected true\n" "::xotcl::dispatch Class ::xotcl::cmd::Class::class-method method {\n" "-per-object:switch\n" "name arguments body -precondition -postcondition} {\n" Index: generic/predefined.xotcl =================================================================== diff -u -r142687efa93af981936db61ecfde494d8f269b0a -r2f283277aff2bb9488419a4fbe2442a5b17546e5 --- generic/predefined.xotcl (.../predefined.xotcl) (revision 142687efa93af981936db61ecfde494d8f269b0a) +++ generic/predefined.xotcl (.../predefined.xotcl) (revision 2f283277aff2bb9488419a4fbe2442a5b17546e5) @@ -43,10 +43,10 @@ # TODO: info methods shows finally "slots" and "slot". Wanted? # protect some methods against redefinition - ::xotcl::methodproperty Object destroy static true - ::xotcl::methodproperty Class alloc static true - ::xotcl::methodproperty Class dealloc static true - ::xotcl::methodproperty Class create static true + ::xotcl::methodproperty Object destroy redefine-protected true + ::xotcl::methodproperty Class alloc redefine-protected true + ::xotcl::methodproperty Class dealloc redefine-protected true + ::xotcl::methodproperty Class create redefine-protected true # define method "method" for Class and Object ::xotcl::dispatch Class ::xotcl::cmd::Class::class-method method { Index: generic/tclAPI.h =================================================================== diff -u -r142687efa93af981936db61ecfde494d8f269b0a -r2f283277aff2bb9488419a4fbe2442a5b17546e5 --- generic/tclAPI.h (.../tclAPI.h) (revision 142687efa93af981936db61ecfde494d8f269b0a) +++ generic/tclAPI.h (.../tclAPI.h) (revision 2f283277aff2bb9488419a4fbe2442a5b17546e5) @@ -55,12 +55,12 @@ static int convertToMethodproperty(Tcl_Interp *interp, Tcl_Obj *objPtr, XOTclParam CONST *pPtr, ClientData *clientData) { int index, result; - static CONST char *opts[] = {"protected", "public", "static", "slotobj", NULL}; + static CONST char *opts[] = {"protected", "redefine-protected", "slotobj", NULL}; result = Tcl_GetIndexFromObj(interp, objPtr, opts, "methodproperty", 0, &index); *clientData = (ClientData) index + 1; return result; } -enum MethodpropertyIdx {MethodpropertyNULL, MethodpropertyProtectedIdx, MethodpropertyPublicIdx, MethodpropertyStaticIdx, MethodpropertySlotobjIdx}; +enum MethodpropertyIdx {MethodpropertyNULL, MethodpropertyProtectedIdx, MethodpropertyRedefine_protectedIdx, MethodpropertySlotobjIdx}; static int convertToRelationtype(Tcl_Interp *interp, Tcl_Obj *objPtr, XOTclParam CONST *pPtr, ClientData *clientData) { int index, result; Index: generic/xotcl.c =================================================================== diff -u -r142687efa93af981936db61ecfde494d8f269b0a -r2f283277aff2bb9488419a4fbe2442a5b17546e5 --- generic/xotcl.c (.../xotcl.c) (revision 142687efa93af981936db61ecfde494d8f269b0a) +++ generic/xotcl.c (.../xotcl.c) (revision 2f283277aff2bb9488419a4fbe2442a5b17546e5) @@ -2177,7 +2177,7 @@ int result, ok; Tcl_Command cmd = FindMethod(nsPtr, methodName); - ok = cmd ? (Tcl_Command_flags(cmd) & XOTCL_CMD_STATIC_METHOD) == 0 : 1; + ok = cmd ? (Tcl_Command_flags(cmd) & XOTCL_CMD_REDEFINE_PROTECTED_METHOD) == 0 : 1; if (ok) { result = TCL_OK; } else { @@ -10672,11 +10672,11 @@ } if (methodproperty == MethodpropertyProtectedIdx - || methodproperty == MethodpropertyStaticIdx) { + || methodproperty == MethodpropertyRedefine_protectedIdx) { int flag = methodproperty == MethodpropertyProtectedIdx ? XOTCL_CMD_PROTECTED_METHOD : - XOTCL_CMD_STATIC_METHOD; + XOTCL_CMD_REDEFINE_PROTECTED_METHOD; if (value) { int bool, result; Index: generic/xotcl.h =================================================================== diff -u -r815c11d71dff9a1af0f2c48e1be2f58e201dad6a -r2f283277aff2bb9488419a4fbe2442a5b17546e5 --- generic/xotcl.h (.../xotcl.h) (revision 815c11d71dff9a1af0f2c48e1be2f58e201dad6a) +++ generic/xotcl.h (.../xotcl.h) (revision 2f283277aff2bb9488419a4fbe2442a5b17546e5) @@ -144,10 +144,10 @@ # endif #endif -#define XOTCL_CMD_PROTECTED_METHOD 0x00010000 -#define XOTCL_CMD_STATIC_METHOD 0x00020000 +#define XOTCL_CMD_PROTECTED_METHOD 0x00010000 +#define XOTCL_CMD_REDEFINE_PROTECTED_METHOD 0x00020000 /* XOTCL_CMD_NONLEAF_METHOD is used to flag, if a Method implemented via cmd calls "next" */ -#define XOTCL_CMD_NONLEAF_METHOD 0x00040000 +#define XOTCL_CMD_NONLEAF_METHOD 0x00040000 /* * A special definition used to allow this header file to be included Index: library/lib/xotcl1.xotcl =================================================================== diff -u -r142687efa93af981936db61ecfde494d8f269b0a -r2f283277aff2bb9488419a4fbe2442a5b17546e5 --- library/lib/xotcl1.xotcl (.../xotcl1.xotcl) (revision 142687efa93af981936db61ecfde494d8f269b0a) +++ library/lib/xotcl1.xotcl (.../xotcl1.xotcl) (revision 2f283277aff2bb9488419a4fbe2442a5b17546e5) @@ -31,10 +31,10 @@ } # protect some methods against redefinition - ::xotcl::methodproperty Object destroy static true - ::xotcl::methodproperty Class alloc static true - ::xotcl::methodproperty Class dealloc static true - ::xotcl::methodproperty Class create static true + ::xotcl::methodproperty Object destroy redefine-protected true + ::xotcl::methodproperty Class alloc redefine-protected true + ::xotcl::methodproperty Class dealloc redefine-protected true + ::xotcl::methodproperty Class create redefine-protected true # define instproc and proc ::xotcl::dispatch Class ::xotcl::cmd::Class::class-method instproc { Index: tests/protected.xotcl =================================================================== diff -u -r142687efa93af981936db61ecfde494d8f269b0a -r2f283277aff2bb9488419a4fbe2442a5b17546e5 --- tests/protected.xotcl (.../protected.xotcl) (revision 142687efa93af981936db61ecfde494d8f269b0a) +++ tests/protected.xotcl (.../protected.xotcl) (revision 2f283277aff2bb9488419a4fbe2442a5b17546e5) @@ -81,10 +81,10 @@ ? {c2 bar-SET} 1 ? {catch {c2 bar-foo} errorMsg; set errorMsg} {::c1: unable to dispatch method 'foo'} -? {::xotcl::methodproperty C SET static true} 1 +? {::xotcl::methodproperty C SET redefine-protected true} 1 ? {catch {C method SET {a b c} {...}} errorMsg; set errorMsg} \ {Method 'SET' of ::C can not be overwritten. Derive e.g. a sub-class!} -? {::xotcl::methodproperty C foo static true} 1 +? {::xotcl::methodproperty C foo redefine-protected true} 1 ? {catch {C method foo {a b c} {...}} errorMsg; set errorMsg} \ {Method 'foo' of ::C can not be overwritten. Derive e.g. a sub-class!} # check a predefined protection @@ -103,7 +103,7 @@ # overwrite-protect object specific method Object create o o method foo {} {return 13} -::xotcl::methodproperty o foo static true +::xotcl::methodproperty o foo redefine-protected true ? {catch {o method foo {} {return 14}} errorMsg; set errorMsg} \ {Method 'foo' of ::o can not be overwritten. Derive e.g. a sub-class!}