Subject: [Fwd: OPEN SPEC: Introspection Package] - DN [1]


"Bruce S. O. Adams" <bruce.adams@rmc-ltd.com> - 19 Mar 1999 - comp.lang.tcl

 -------- Original Message --------
 Subject: OPEN SPEC: Introspection Package
 Date: Thu, 18 Mar 1999 20:54:10 +0000
 From: "Bruce S. O. Adams" <brucea@ nospam cybernetics demon co uk>
 Newsgroups: comp.lang.tcl

 As requested I am posting an outline of the basic specification for my
 Introspeciton package for discussion.
 Any comments, features, questions and suggestions are welcome.
         Regards,
                      Bruce A.

 =============================================================

 Introspection_Spec.txt
 ======================

 Brief: outline specification for Introspection package

 Introduction
 ============

    The aim of this package is to extended the basic introspection
 functionality of
 the TCL core (8.0 and above) with a view to aid in meta-programming an
 AI related
 tasks.  This package is still under active development and there is at
 present
 some overlap with a meta programming package which is intended for
 separate release.
 The package is intended for release as both open source and open
 specification.
     At present TK has not be taken into consideration.  Features and
 suggestions
 are always welcome (send to Email address below).

 Features
 ========

 * Aims to provide information on 100% of the internal state of the TCL
 interpreter

 * can optionally be 'installed' to overide and extend inbuilt commands
   or be used via direct calls to the introspection namespace

 Basic Installation structure
 ============================

 * package is namespaced
    * the main namespace is Introspection
    * the Meta namespace referrs to a less developed meta-programming
 package

 * package has initialize and terminate routines which should be call
   prior to loaded and unloading the package respectively
           i.e.  Introspection::Initialize & Introspection::Terminate

 * package has install and uninstall routines which cause the overriding
 of inbuilt
   commands (primarily info) and reversion to normal state respectively.
   Note: These require the less developed meta-programming package to
 function
    i.e. Introspection::Install & Instrospection::UnInstall

 * package is initially being developed as a pure TCL extension.  A
 compiled C extension
   (providing functionality not possible in TCL alone) is to follow at a
 later date.

 Shared Command API
 ==================

 Where possible / appropriate all commands are to share the same API with
 the following basic
 features

 * selection of a specific interpreter

 * selection of a set of patterns to filter in

 * selection of a set of patterns to filter out (antipatterns)

 Commands provided
 =================

 info namespaces
      - recursively list all namespaces in existance in a given
 interpreter

 info allVars
      - list all variables across all namespaces in existance in a given
 interpreter

 info allProcs
      - list all procedures across all namespaces existing in a given
 interpreter

 info allCommands
      - list all commands (compiled procedures - but see note) across all
 namespaces
        existing in a given interpreter

 info channels
      - list all open channels across all namespaces existing in a given
 interpreter

 info interps
      - list all subinterpreters (across all namespaces) of a given
 interpreter

 info inbuilt
      - returns a list of all builtin/default commands for an interpreter

 info builtin
      - boolean predicate returning true if and only if the given
 procedure name
        is a builtin/default command of the given interpreter

 info renames
      - returns a list of all command renamings that have been done in
 the given
        interpreter

 info original
      - returns the original name of a procedure

 info renamed
      - returns what name has been given to a procedure given its
 original name

 info compiled
      - boolean predicate returning true if and only if the given
 proceure name
        is a compiled procedure (i.e. one for which info body would
 return an error)

 info packages
      - lists the packages loaded by a given interpreter (info loaded
 only lists compiled extensions)

 info args
      - lists the arguments of _both_ compiled and interpreted procedures
 (not possible via TCL alone)

 info default
      - lists the default values for arguments of both compiled and
 interpreted procedures
        (not possible via TCL alone)

 ===
 Aside from a myriad other uses, the following give TCL a saveable
 runtime state.
 Additional switches will allow the selection of subsets of the state to
 import or export

 interp export
      - allows properties of a given interpreter to be exported (probably
 as a TCL source file)

 interp import
      - allows properties of a given interpreter to be imported

 interp clear
      - allows properteis of a given interpreter to be reset

 ====
 Meta programming commands used by introspection package

 Meta::AddSubCommand
      - adds a new subcommand to a command (existing or otherwise)
        (the original is renamed, commands are called through means of a
 wrapper containing a switch statement)

 Meta::DeleteSubCommand
      - removes a subcommand from a command

 Status
 ======

 The TCL version of all the above routines is complete (apart from bugs
 known & unknown :-)
 with the following exceptions:

 interp export
 interp import
 interp clear

 info args      (not possible in TCL alone)
 info default   (not possible in TCL alone)

 Contacts
 ========

 This package is presently being developed by Bruce S. O. Adams  in the
 United Kingdom

 Email - home:  brucea @ removethis cybernetics . demon . co . uk
         Work:  bruce.adams@rmc-ltd.com    (answered more frequently but
 not site of development)

 # End File Introspection_Spec.txt

Last modified
1999-09-27

(195.108.246.50)

Note: you are looking at
the snapshot of an old wiki
- much of this information
is likely to be very outdated