This is not necessarily the current version of this TIP.
|Title:||Add a 'chan' Command|
|Version:||$Revision: 1.4 $|
|Author:||Jeff Hobbs <jeffh at activestate dot com>|
|Created:||Friday, 02 July 2004|
This TIP proposes adding a chan command that would serve as a top-level command container for all the related channel commands that have proliferated over time, as well as future new channel-based commands.
Tcl's channel system has evolved over time from a thin layer on top of the OS into a very complex, multi-platform system. There are numerous top-level commands for channels already, with more being proposed for Tcl 8.5. This command would centralize them, making it easier for new users to see all the related channel commands, much as string or file operate today.
The name chan was chosen over channel because it is a clearly recognizable abbreviation, much like eval vs. evaluate and interp vs interpreter.
A new command chan will be added with the following syntax:
chan blocked ; # fblocked chan close ; # close chan configure ; # fconfigure chan copy ; # fcopy chan eof ; # eof chan event ; # fileevent chan flush ; # flush chan gets ; # gets chan names ; # file channels chan puts ; # puts chan read ; # read chan seek ; # seek chan tell ; # tell chan truncate ; # ftruncate (if TIP#206 had been accepted)
Each represents the existing command that is commented. The arguments to each would remain what the current command takes.
Note that open is not included above, as it is a channel creation function, just like socket.
[See TIP #206 for Rationale]
chan truncate channelId ?length?
The channel specified by channelId must refer to a file that was opened for writing. The length argument must be greater than or equal to zero and can be bigger than the curr