Tcl Source Code

View Ticket
Login
Ticket UUID: 455867
Title: Introspect channels by type
Type: RFE Created on: 2001-08-27 19:22:54
Submitter: dgp Assigned to: aku
Subsystem: 25. Channel System Severity: Minor
Priority: 5 Medium Last modified: 2019-06-03 16:07:43
Status: Open Closed by: nobody
Resolution: None Closed on:
Version: None
Description:
The Tcl command [file channels $pattern] returns
a list of the names of all open channels, where
the name matches $pattern.

However, the names of channels are not documented
to have any particular properties.  They are just
tokens to be passed around by commands that
manipulate or use channels.

Also, any channel that happens to be aliased
to a standard channel becomes known by the
std channel name (f.e. stdout) in the
[file channels] output, not matter what its
original names was.

So. [file channels sock*] is not a foolproof
way to get a list of all open sockets.

We need another means to introspect channels
by their Tcl_ChannelType.
User Comments:
dgp added on 2001-08-28 02:23:41:
Logged In: YES 
user_id=80530

See also Tcl bug 419685

andreas_kupries added on 2001-09-20 06:33:46:
Logged In: YES 
user_id=75003

A possible interface would be:

1) [file channeltypes] returns a list of registered channel 
types, aka channel drivers.

2) [file channels -type typename] lists all channels having 
the given type.

vincentdarley added on 2001-09-20 22:27:31:
Logged In: YES 
user_id=32170

This might be a good occasion to NOT extend file, but add 
a 'channel' command to Tcl:

channel types
channel names (-type typename) pat
etc.

In the future this could be extended with 'channel 
transform'.  I don't think further overloading of 'file' is 
the right place for this stuff (but I'm v. happy to hear 
arguments to the contrary).

andreas_kupries added on 2001-09-21 01:33:37:
Logged In: YES 
user_id=75003

I will not argue against this. I am still wondering
how we wound up with [file channels]. Unfortunately it is 
already in 8.3.3 and not in one the 8.4 alphas or I would 
change that to [channel names] in a jiffy.

dgp added on 2007-09-06 05:22:32:
Logged In: YES 
user_id=80530
Originator: YES


It appears the new [chan names]
in Tcl 8.5 is just another name
for [file channels] which still
just does glob matching on the
channel name.  Introspection on
the name of the channel type is
still missing.

andreas_kupries added on 2007-09-06 05:23:51:
Logged In: YES 
user_id=75003
Originator: NO

In 8.5 the command 'chan names' implements the same functionality. Internally mapped to '::file channels'.

andreas_kupries added on 2007-09-06 05:24:45:
Logged In: YES 
user_id=75003
Originator: NO

Oh, by type. Yes, that we do not have anywhere.

dgp added on 2019-06-03 16:07:43:
See TIP 411