Colin McCormack - 2004-09-14

Logged In: YES
user_id=19214

Memchan is used extensively in tclvfs file systems to
provide [open] functionality.

However, a memchan doesn't have the ability to mark itself
as either read- or write-only, which means that every tclvfs
using memchan, asked to open a file in w mode will in fact
return it in w+ mode.

It wouldn't make sense to mark a memchan either read- or
write-only upon creation since you have to be able to put
something into it before it can be read out.

However, it would perhaps be useful to add an fconfigure
option to set a memchan -readonly or -writeonly ... perhaps
in a manner that can't be turned off. Then a tclvfs could
simulate a read-only channel by [set fd [memchan];
fconfigure $fd -readonly].

Unfortunately, this functionality (changing mode after
creation) might depend upon the ability to set mode bits in
a Channel, which is not currently exported for extensions to
use. In that case, I'm not sure how one would go about
implementing this RFE.