home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!cis.ohio-state.edu!magnus.acs.ohio-state.edu!usenet.ins.cwru.edu!agate!sprite.Berkeley.EDU!ouster
- From: ouster@sprite.Berkeley.EDU (John Ousterhout)
- Newsgroups: comp.lang.tcl
- Subject: Re: How do I imbed tcl in an application
- Date: 29 Jul 1992 16:15:24 GMT
- Organization: U.C. Berkeley Sprite Project
- Lines: 40
- Distribution: world
- Message-ID: <156g6sINNnp2@agate.berkeley.edu>
- References: <1992Jul27.175107.7633@rchland.ibm.com> <ADRIANHO.92Jul27175403@barkley.berkeley.edu> <1992Jul28.113922.19882@cas.org>
- NNTP-Posting-Host: tyranny.berkeley.edu
-
- A couple of comments on this.
-
- First, in response to Kevin Kenny's question about the noun-versus-verb
- approach to Tcl commands:
-
- John Ousterhout has experimented with both methods: files in Tcl are
- identified by handles, while widgets in Tk are independent commands
- having client data. John, do you have anything to add about the
- tradeoffs?
-
- I don't have much to add to this. To tell the truth, I never thought
- very explicitly about this choice until seeing it in Kevin's message.
- I used the handle approach for files because that seemed a natural
- imitation of the corresponding UNIX C procedures, and I used the
- "object-name-as-command" approach for Tk widgets because that provided
- for a uniform approach across all widget types and allowed inidividual
- widget types to define different sets of sub-commands without polluting
- the Tcl command space. In retrospect, I think I like the "object-name-as
- command" approach better, but I think it works best for moderate numbers
- of objects (10's or 100's). If there are a million objects, then I think
- the handle approach would have significantly lower overhead.
-
- Second, Larry Virden asked about the extension at the level of sub-commands:
-
- Something that I have been wondering about along these lines is based on
- John's two initial papers. They described the tcl/tk environment in
- such a way that it seemed that a user would be able to write their own
- extended sub-options for tcl commands and then the application would
- read these extentions / parameters , etc and allow the user customizations.
-
- Did I get the wrong idea? Is there a way for me to add new commands to
- a tcl/tk application automatically, or does each application need to add
- code to handle this possibility? If so, where does that fit into the
- previously described skeleton that you folks are talking about?
-
- You can add commands, but you can't add subcommands to existing commands.
- For example, if you wanted to add a "remove" option to the string command,
- so that you could say "string remove <string> <letter>" to remove all
- instances of <letter> from <string>, you'd have to modify the C code that
- implements "string".
-