Version 4 of info type

Updated 2013-07-12 14:44:06 by escargo

DKF: Proposed new feature for Tcl. [See fossil branch 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 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?