1 Article 1475 of comp.lang.tcl:
2 Path: netlabs!news!usc!cs.utexas.edu!sun-barr!ames!agate!sprite.Berkeley.EDU!ouster
3 From: ouster@sprite.Berkeley.EDU (John Ousterhout)
4 Newsgroups: comp.lang.tcl
5 Subject: Planning for Tcl 7.0
6 Message-ID: <1avu22INN5ao@agate.berkeley.edu>
7 Date: 8 Oct 92 00:06:26 GMT
8 Organization: U.C. Berkeley Sprite Project
10 NNTP-Posting-Host: tyranny.berkeley.edu
13 For the last year I've made only small changes to Tcl while focussing
14 on the canvas and text widgets for Tk. I'm now making plans to catch
15 up on a bunch of much-needed bug fixes and enhancements to Tcl. Some
16 of the changes I'm considering are not backwards-compatible. The
17 purpose of this message is to let know know what changes I'm considering
18 for Tcl 7.0 and to solicit feedback. I'm particularly interested in
19 comments on the changes that are incompatible: I'll probably drop
20 the changes for which I get lots of negative feedback and not much
21 positive feedback. If there are other changes that you think are
22 important but aren't contained on this list, let me know and I may add
28 The changes listed below are likely to require changes to existing
29 scripts and/or C code. Each change includes an explanation of why the
30 change might be useful. I'd like to know whether or not you think the change
31 is useful enough to justify the incompatibility.
33 1. Eliminate the "|" option in the "open" command. Instead, add a
34 "popen" command that does the same thing. Rationale: in the current
35 implementation you can't open a file whose name begins with "|".
36 Also, I think the "popen" command would be more logical.
38 2. Eliminate the Tcl_WaitPids procedure and use the waitpid POSIX call
39 instead. Also change the wait code to periodically poll for dead
40 child processes so that zombie processes don't get left around forever.
41 Rationale: the current code tends to leave zombies around in some
42 situations. Switching to waitpid should solve this problem in a
43 relatively portable fashion. The only incompatibility will be for
44 C procedures that call Tcl_WaitPids; they'll have to switch to call
45 waitpid instead. I'll provide a compatibility version of waitpid for
46 use on systems that don't have it yet.
48 3. Clean up backslash processing in several ways:
49 - Change backslash-newline to eat up all the whitespace following the
50 newline and replace the sequence with a single whitespace character.
51 Right now it only eats up the newline character and replaces it
52 with an empty string. Rationale: this would be more consistent
53 with other programs that process backslash-newline sequences.
54 - Eliminate the sequences \Mxx, \Cxxx, and \e.
55 Rationale: these sequences are left around from ancient times.
56 They're not particular compatible with any other program. I
57 should have removed them in Tcl 6.0 but didn't. They did get
58 removed from the documentation, however, so no-one should be
60 - Change \x (where x is not one of the characters that gets special
61 backslash treatment) to expand to x, not \x.
62 Rationale: the current behavior is inconsistent with all other
63 programs I know of that handle backslashes, and I think it's
65 - Change "format" so it doesn't do an additional layer of backslash
66 processing on its format string.
67 Rationale: I don't know why it currently behaves as it does, and
68 I think it's confusing.
70 4. Change "regsub" so that when no match occurs it sets the result
71 variable to the original string, rather than leaving it unmodified.
72 Rationale: the current behavior results in extra tests of the regsub
73 result that could sometimes be avoided with the proposed new behavior.
74 I doubt that there's much code that will break with the change (this
75 would have to be code that depends on the result variable *not* being
78 5. Change the name "UNIX" in the "errorCode" variable to "POSIX".
79 Rationale: I suspect that I'm eventually going to get a call from the
80 USL lawyers on this one if I don't change it. Better to change it now
81 in an orderly fashion so I don't have change it hastily in the future.
83 6. Change glob to return only the names of existing files.
84 Rationale: at present "glob */foo" expands * and generates a result
85 without checking to see if each directory has a "foo" file in it. This
86 makes the current behavior incompatible with csh, for example. One
87 question is whether constructs like "glob {a,b}.c" should also check for
88 the existence of each of the files. At present they don't (i.e. a.c and
89 b.c will be returned even if they don't exist), but neither does csh. My
90 inclination is to make the behavior match csh (names containing *?[] are
91 checked for existence, others aren't). I'd be interested to hear
92 opinions on this one: check all names for existence, check only names
93 including *?[] (for csh compatibility), or keep it as it is?
95 7. Change "gets" so it returns 1 for success and 0 for failure. At present
96 it returns the line length for success and -1 for failure.
97 Rationale: this would allow slightly simple Tcl scripts: you could just
99 while [gets $f line] {...}
101 while {[gets $f line] >= 0} {...}
102 I'm not really convinced that this one is important enough to justify the
103 incompatibility, so it won't take much negative feedback to kill it.
108 The changes listed below shouldn't introduce substantial compatibility
109 problems. Of course, any change can potentially cause scripts to stop
110 working (e.g. almost any change will break the test suite), but very
111 few if any people should be affected by these changes.
113 8. Implement Tcl_CreateExternVar() procedure along lines proposed by
114 Andreas Stolcke to tie a C variable to a Tcl variable with automatic
115 updates between them.
118 - Allow redirection to an existing file descriptor in "exec",
119 with a mechanism like >&1 or >& stdout.
120 - Allow file names immediately after ">" and "<" without
123 10. Changes related to files:
124 - Fix Scott Bolte bug (closing stdin and stdout).
125 - Move TclGetOpenFile and OpenFile stuff to tcl.h so that they're
126 accessible to applications.
127 - Extend access modes in open to include the complete set of POSIX
128 access modes (such as O_EXCL and O_NONBLOCK).
130 11. Re-instate Tcl_WatchInterp to notify application when an interpreter
133 12. Add "elseif" mechanism to "if" command for chaining "else {if ..."
134 constructs more cleanly. Require exact matches on "then" and "else"
137 13. Remove UNIX system call declarations from tclUnix.h. Use them from
138 unistd.h instead, and provide a default version of unistd.h for systems
141 14. Changes in the expr command, mostly following suggestions made by
142 George Howlett a long time ago:
143 - Increase precision of floating-point results.
144 - Make floating-point numbers always print with a point.
145 - Add transcendental functions like sin and exp.
146 - Add explicit integer and floating conversion operations.
147 - Don't promote large integers to floating-point automatically.
148 - Allow multiple arguments to expr command.
150 15. Extend lsort to allow alternate sorting mechanisms, like numeric,
153 16. Allow alternate pattern-matching forms (e.g. exact or regexp) for
156 17. Add XPG/3 positional argument specifiers to format (code contributed
159 18. Change "file readlink" to return an error on systems that don't
160 support it rather than removing the option entirely.
162 19. Add a mechanism for scheduling a Tcl command to be executed when the
163 interpreter reaches a clean point. This is needed for things like
166 20. Change upvar so that you can refer to an element of an array as
167 well as a whole array.