TIP #208 Version 1.1: Add a 'chan' Command

This is not necessarily the current version of this TIP.


TIP:208
Title:Add a 'chan' Command
Version:$Revision: 1.1 $
Author:Jeff Hobbs <jeffh at activestate dot com>
State:Draft
Type:Project
Tcl-Version:8.5
Vote:Pending
Created:Friday, 02 July 2004
Keywords:Tcl

Abstract

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.

Rationale

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.

Specification

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 puts       ; # puts
      chan read       ; # read
      chan seek       ; # seek
      chan tell       ; # tell

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.

Future Possibilities for Extending the 'chan' Command

I would also recommend that TIP #206 be integrated as chan truncate. Further TIPs may also recommend subcommands such as chan transform, chan stack and chan unstack (exposing the channel stacking subsystem available in the C API), among other possibilities.

Deprecation of Existing Commands

In addition, I would recommend only the following commands be marked deprecated so as to help systematize their names better:

      fblocked
      fconfigure
      fcopy
      fileevent

Reference Implementation

The implementation of this TIP is really a simple command that makes use of the existing command implementations. It could be a namespace ensemble or a C-based command.

Copyright

This document has been placed in the public domain.


Powered by TclThis is not necessarily the current version of this TIP.

TIP AutoGenerator - written by Donal K. Fellows