perl 5.0 alpha 8
[p5sagit/p5-mst-13.2.git] / TCL
CommitLineData
2304df62 1Article 1475 of comp.lang.tcl:
2Path: netlabs!news!usc!cs.utexas.edu!sun-barr!ames!agate!sprite.Berkeley.EDU!ouster
3From: ouster@sprite.Berkeley.EDU (John Ousterhout)
4Newsgroups: comp.lang.tcl
5Subject: Planning for Tcl 7.0
6Message-ID: <1avu22INN5ao@agate.berkeley.edu>
7Date: 8 Oct 92 00:06:26 GMT
8Organization: U.C. Berkeley Sprite Project
9Lines: 156
10NNTP-Posting-Host: tyranny.berkeley.edu
11
12
13For the last year I've made only small changes to Tcl while focussing
14on the canvas and text widgets for Tk. I'm now making plans to catch
15up on a bunch of much-needed bug fixes and enhancements to Tcl. Some
16of the changes I'm considering are not backwards-compatible. The
17purpose of this message is to let know know what changes I'm considering
18for Tcl 7.0 and to solicit feedback. I'm particularly interested in
19comments on the changes that are incompatible: I'll probably drop
20the changes for which I get lots of negative feedback and not much
21positive feedback. If there are other changes that you think are
22important but aren't contained on this list, let me know and I may add
23them.
24
25Incompatible changes:
26---------------------
27
28The changes listed below are likely to require changes to existing
29scripts and/or C code. Each change includes an explanation of why the
30change might be useful. I'd like to know whether or not you think the change
31is useful enough to justify the incompatibility.
32
331. Eliminate the "|" option in the "open" command. Instead, add a
34"popen" command that does the same thing. Rationale: in the current
35implementation you can't open a file whose name begins with "|".
36Also, I think the "popen" command would be more logical.
37
382. Eliminate the Tcl_WaitPids procedure and use the waitpid POSIX call
39instead. Also change the wait code to periodically poll for dead
40child processes so that zombie processes don't get left around forever.
41Rationale: the current code tends to leave zombies around in some
42situations. Switching to waitpid should solve this problem in a
43relatively portable fashion. The only incompatibility will be for
44C procedures that call Tcl_WaitPids; they'll have to switch to call
45waitpid instead. I'll provide a compatibility version of waitpid for
46use on systems that don't have it yet.
47
483. 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
59 using them (?).
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
64 confusing.
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.
69
704. Change "regsub" so that when no match occurs it sets the result
71variable to the original string, rather than leaving it unmodified.
72Rationale: the current behavior results in extra tests of the regsub
73result that could sometimes be avoided with the proposed new behavior.
74I doubt that there's much code that will break with the change (this
75would have to be code that depends on the result variable *not* being
76modified).
77
785. Change the name "UNIX" in the "errorCode" variable to "POSIX".
79Rationale: I suspect that I'm eventually going to get a call from the
80USL lawyers on this one if I don't change it. Better to change it now
81in an orderly fashion so I don't have change it hastily in the future.
82
836. Change glob to return only the names of existing files.
84Rationale: at present "glob */foo" expands * and generates a result
85without checking to see if each directory has a "foo" file in it. This
86makes the current behavior incompatible with csh, for example. One
87question is whether constructs like "glob {a,b}.c" should also check for
88the existence of each of the files. At present they don't (i.e. a.c and
89b.c will be returned even if they don't exist), but neither does csh. My
90inclination is to make the behavior match csh (names containing *?[] are
91checked for existence, others aren't). I'd be interested to hear
92opinions on this one: check all names for existence, check only names
93including *?[] (for csh compatibility), or keep it as it is?
94
957. Change "gets" so it returns 1 for success and 0 for failure. At present
96it returns the line length for success and -1 for failure.
97Rationale: this would allow slightly simple Tcl scripts: you could just
98say
99 while [gets $f line] {...}
100instead of
101 while {[gets $f line] >= 0} {...}
102I'm not really convinced that this one is important enough to justify the
103incompatibility, so it won't take much negative feedback to kill it.
104
105Other changes:
106--------------
107
108The changes listed below shouldn't introduce substantial compatibility
109problems. Of course, any change can potentially cause scripts to stop
110working (e.g. almost any change will break the test suite), but very
111few if any people should be affected by these changes.
112
1138. Implement Tcl_CreateExternVar() procedure along lines proposed by
114Andreas Stolcke to tie a C variable to a Tcl variable with automatic
115updates between them.
116
1179. Changes to exec:
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
121 intervening spaces.
122
12310. 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).
129
13011. Re-instate Tcl_WatchInterp to notify application when an interpreter
131is deleted.
132
13312. Add "elseif" mechanism to "if" command for chaining "else {if ..."
134constructs more cleanly. Require exact matches on "then" and "else"
135keywords.
136
13713. Remove UNIX system call declarations from tclUnix.h. Use them from
138unistd.h instead, and provide a default version of unistd.h for systems
139that don't have one.
140
14114. Changes in the expr command, mostly following suggestions made by
142George 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.
149
15015. Extend lsort to allow alternate sorting mechanisms, like numeric,
151or client-supplied.
152
15316. Allow alternate pattern-matching forms (e.g. exact or regexp) for
154lsearch and case.
155
15617. Add XPG/3 positional argument specifiers to format (code contributed
157by Mark Diekhans).
158
15918. Change "file readlink" to return an error on systems that don't
160support it rather than removing the option entirely.
161
16219. Add a mechanism for scheduling a Tcl command to be executed when the
163interpreter reaches a clean point. This is needed for things like
164signal support.
165
16620. Change upvar so that you can refer to an element of an array as
167well as a whole array.
168
169