Index: generic/xotcl.c =================================================================== diff -u -r5a8f729f1007a41a4ecef05c11522a439564022e -rae50f752a447d5302ff8c241be8e4891ce0b4bb7 --- generic/xotcl.c (.../xotcl.c) (revision 5a8f729f1007a41a4ecef05c11522a439564022e) +++ generic/xotcl.c (.../xotcl.c) (revision ae50f752a447d5302ff8c241be8e4891ce0b4bb7) @@ -10382,17 +10382,27 @@ } #endif } else { - /* must be an alias */ - switch (subcmd) { - case InfomethodsubcmdTypeIdx: - Tcl_SetObjResult(interp, XOTclGlobalObjs[XOTE_ALIAS]); - break; - case InfomethodsubcmdDefinitionIdx: - { - Tcl_Obj *entryObj = AliasGet(interp, object->cmdName, methodName, withPer_object); - /*fprintf(stderr, "aliasGet %s -> %s (%d) returned %p\n", - objectName(object), methodName, withPer_object, entryObj);*/ - if (entryObj) { + /* + * The cmd must be an alias or object. + * + * Note that some aliases come with procPtr == XOTclObjDispatch. + * In order to dinstinguish between "object" and alias, we have + * to do the lookup for the entryObj to determine wether it is + * really an alias. + */ + + Tcl_Obj *entryObj = AliasGet(interp, object->cmdName, methodName, withPer_object); + /*fprintf(stderr, "aliasGet %s -> %s (%d) returned %p\n", + objectName(object), methodName, withPer_object, entryObj);*/ + + if (entryObj) { + /* is an alias */ + switch (subcmd) { + case InfomethodsubcmdTypeIdx: + Tcl_SetObjResult(interp, XOTclGlobalObjs[XOTE_ALIAS]); + break; + case InfomethodsubcmdDefinitionIdx: + { int nrElements; Tcl_Obj **listElements; resultObj = Tcl_NewListObj(0, NULL); @@ -10405,6 +10415,43 @@ break; } } + } else { + /* check, to be on the safe side */ + if (procPtr == XOTclObjDispatch) { + /* is an object */ + switch (subcmd) { + case InfomethodsubcmdTypeIdx: + Tcl_SetObjResult(interp, Tcl_NewStringObj("object", -1)); + break; + case InfomethodsubcmdDefinitionIdx: + { + /* yyyy */ + XOTclObject *subObject = XOTclGetObjectFromCmdPtr(cmd); + assert(subObject); + resultObj = Tcl_NewListObj(0, NULL); + /* we can make + create + or something similar to the other definition cmds + createChild + */ + AppendMethodRegistration(interp, resultObj, "create", + &(subObject->cl)->object, + ObjStr(subObject->cmdName), cmd, 0, 0); + /* + AppendMethodRegistration(interp, resultObj, "subobject", + object, methodName, cmd, 0, 0); + Tcl_ListObjAppendElement(interp, resultObj, subObject->cmdName);*/ + + Tcl_SetObjResult(interp, resultObj); + break; + } + } + } else { + /* should never happen */ + fprintf(stderr, "should never happen, maybe someone deleted the alias %s for object %s\n", + methodName, objectName(object)); + Tcl_ResetResult(interp); + } } } } Index: library/nx/nx.tcl =================================================================== diff -u -r5a8f729f1007a41a4ecef05c11522a439564022e -rae50f752a447d5302ff8c241be8e4891ce0b4bb7 --- library/nx/nx.tcl (.../nx.tcl) (revision 5a8f729f1007a41a4ecef05c11522a439564022e) +++ library/nx/nx.tcl (.../nx.tcl) (revision ae50f752a447d5302ff8c241be8e4891ce0b4bb7) @@ -379,8 +379,8 @@ if {$definition eq ""} {error "definition must not be empty"} set object [lindex $definition end] } else { - if {$type ne "alias"} {error "can't append to $type"} - if {$definition ne ""} {error "unexpected definition '$definition'"} + if {$type ne "object"} {error "can't append to $type"} + if {[llength $definition] != 3} {error "unexpected definition '$definition'"} append object ::$w } } @@ -751,6 +751,7 @@ # copy all methods except the subobjects to ::nx::Class::slot::__info # foreach m [::nx::Object::slot::__info ::nsf::cmd::ObjectInfo2::methods] { + if {[::nx::Object::slot::__info ::nsf::cmd::ObjectInfo2::method type $m] eq "object"} continue set definition [::nx::Object::slot::__info ::nsf::cmd::ObjectInfo2::method definition $m] ::nx::Class::slot::__info {*}[lrange $definition 1 end] }