[DKF]: Proposed new feature for Tcl. ''[[See [fossil] branch `[https://core.tcl.tk/tcl/timeline?r=dkf-command-type%|%dkf-command-type]`]]'' : '''[info] type''' ''commandName'' Returns a string describing the “type” of the command called ''commandName''. For procedures, it returns '''proc''', for native commands, '''native''', for [interp alias%|%aliases], '''alias'''. There's a few others too. Does not dig deep into the complexities of what the command is, but does provide you with enough information to figure out what sort of introspection to use next. [rmax]: Maybe the command should be called [[info commandtype]] (or [[info cmdtype]] for short), to avoid confusion with other meanings of "type" (e.g. in the sense of typed variables). ---- '''[RFox] - 2013-07-10 18:10:53''' +1 for rmax's suggestion. ---- '''[dkf] - 2013-07-11 08:49:11''' Seems reasonable; this is why it's still on a branch! ---- '''[escargo] - 2013-07-12''' This seems like it ought to work in conjunction with [[info commands]]. So, are there more things that would be valid inputs to [[info commandtype]] than are returned by [[info commands]]? I would also like to see some examples of all the returned values and each of the introspection commands that would be used next. (This might point out where introspection is not implemented deeply enough.) If "command-like" names are the valid inputs, does that mean that [[info commandtype]] can return "method" if the name is a method name? ---- '''[dkf] - 2013-07-14 14:39:34''' But methods are not commands. There is nothing that bridges between the two. (There already is an introspector for method types; has been for a while now.) What this command does is tell you about what sort of command you've got, nothing more, nothing less. Don't be confused by the name. I'm going to change that once I have better network connectivity... ---- '''[escargo] - 2013-07-14''' Here we get into the thicket of implementation and introspection. Don't you invoke methods the same way you invoke commands? If you have something ("commandName") that you can invoke like a command, how do you tell what it is? (Or perhaps, how do you tell how it is implemented?) If you want to be able to resolve details of the implementation of any command-like string argument, then you should be able to handle any inputs reasonably. If your "command invocation" is really a "method invocation," does that mean you should first check to see if your "commandName" is really a method name first? Then, if it is not a method, then use [[info commandtype]] to see what it is? <>Command|Introspection