home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.tcl
- Path: sparky!uunet!eco.twg.com!twg.com!news
- From: "David Herron" <david@twg.com>
- Subject: Re: Multiple Interpreters
- Message-ID: <1993Jan28.173729.29095@twg.com>
- Sensitivity: Personal
- Encoding: 49 TEXT , 4 TEXT
- Sender: news@twg.com (USENET News System)
- Conversion: Prohibited
- Organization: The Wollongong Group, Inc., Palo Alto, CA
- Conversion-With-Loss: Prohibited
- Date: Thu, 28 Jan 1993 17:37:28 GMT
- Lines: 54
-
- omar@wucs1.wustl.edu asks:
- >I know there must be many good uses for having multiple interpreters, but
- >I can't seem to think of any.
-
- Louis is right that the basic advantage is in separate namespaces.
-
- What originally inspired me to do `interp' was a comtemplated
- port of Tk/TCL to DOS (using an Xlib implementation called X/DOS).
- With X/DOS as it is(was at that time) you'd only be able to run one
- TK application at a time. But if multiple interpretors could be
- run, then multiple TK app's could be run.
-
- The current `interp' is unable to do this. Olav's interp module should
- let you do it, if I read it right.
-
-
- If you look at the internals of servicemail you see it starts a
- new TCL interpretor for every message it processes.
-
-
- louie@sayshell.umd.edu (Louis A. Mamakos)
- > Actually, it would be great if a new interpreter could inherit
- > methods/commands from the "super class" or the interpreter that
- > created it, but I can see how that might be difficult to implement.
-
- You're right that it would be difficult to do automatically. However,
- there's a way to do this manually with the existing interp. You create
- the interpretor like so
-
- interp newInterp
- newInterp -setParent parentInterp
-
- `unknown' looks for unknown commands in its parent before it looks
- in MainInterp. Yes that's not quite the same thing as inheritance.
- The other inheritance facility is `-chainCommand' (if someone can suggest
- improved names for these things, I'm all ears...). Again, it's manual
- but works like:
-
- interp newInterp
- foreach cmd { a list of commands to inherit } {
- newInterp -chainCommand $cmd parentInterp
- }
-
- I believe that sufficient facilities are in the interp module for lots
- of interesting things. They aren't automatic (which kinda follows
- the tcl tradition of coding the raw facilities in C leaving the niceties
- to tcl procedures) however.
-
- What I don't know is if they're complete (enough) or well named.
-
- <- David Herron <david@twg.com> (work) <david@davids.mmdf.com> (home)
- <-
- <- "That's our advantage at Microsoft; we set the standards and we can change them."
- <- Karen Hargrove of Microsoft quoted in the Feb 1993 Unix Review editorial.
-