Version 23 of tclx file commands for core

Updated 2004-05-29 02:27:13 by CMCc

Purpose: To get TclX file functionality into the core. These will eventually become TIPs, so any comments or suggestions would be welcome now. Question: is it practical to push for this stuff to be included in the 8.5 release?

The -keepalive option should be added to fconfigure for sockets. Possibly other sockopts should be added to fconfigure too.

Changes to tcl's file command

A new file option -fileid to allow an open file to be processed in place of the file name argument. (This may not be possible under windows.)

  • file truncate [file] for tclx's ftruncate
  • file lock [file] for tclx's flock
  • file unlock [file] for tclx's funlock
  • file dup [fd] for tclx's dup
  • file set [fd] [fd] ... not part of tclx, but would be nice ... [file set stderr [open /tmp/log a+]]]
  • file pipe [<var_r>] [<var_w>] for tclx's pipe command.
  • file isatty [fd] predicate returning true if fd is a tty.

Implementation Considerations

  • The addition of -fileid semantics may be a fair bit of work
  • Interactions with things like
  • Should file be made into an actual ensemble command? Perhaps we're not far enough along with that yet.
  • Can/Should file be moved off as a distinct module within tcl itself?
  • Are the things named by fds refcounted? They'd have to be, if [file dup] and [file set] were to be implemented.

The most frequent request is to move the TclX signal handling commands into Tcl. tclx signal commands for core is here for that. TclX is a grab-bag of useful functionality, a proving ground for new/nice facilities. They should be handled independently, IMHO.

Another suggestion that's been made in the past is to create an extension that provides Tcl bindings for the most useful Posix functions.

But what are the most useful Posix functions? :)

DKF: Useful Posix stuff (to me) has been: all the signal stuff, fork/execl, id and times. YMMV. :^)


Category Suggestion