Re: Why not exit on SIGPIPE





On Oct 13, 9:38 am, Alexandre Ferrieux <alexandre.ferri...@xxxxxxxxx>
wrote:
On Oct 13, 5:35 pm, "tom.rmadilo" <tom.rmad...@xxxxxxxxx> wrote:



Is there any difference between Tcl as a shell (tclsh) and Tcl as a
language? I can't see why a program should exit just because of an
error. Communication errors in particular are not unexpected.

See the beginning of the thread for the rationale.
See the end for the conclusion: we're heading for a [fconfigure]
switch, which you're welcome not to use if you dislike it.

The main target of this switch is stdout, for _filters_, which are a
specific case of glue, with specific properties: when a filters gets
to know that nobody's interested in its output any longer, it makes
sense to exit. The situation is of course utterly different for a more
complex glue with higher connectivity.

I did see the beginning of the thread. Tcl is a programming language.
Bash, and tclsh, and less and more are programs. Putting a switch on a
channel is trying to turn a command into a program. Are there any
other examples of commands doing this? In any language? Even a shell
(the shell command, not the shell)? It seems like poor programming
style and pure laziness. Programming languages need to be simple.
Actually this is one of my biggest gripes with switches. Some
developers think that a switch is okay to add because it is backwards
compatible (the "don't use it if you don't need it" argument...All
switches are used by everyone, every call passes through the switch
handling, source code becomes more complex). In most cases, it is
better to wrap a regular API with a filter to get the behavior you
want.

Instead of coding behavior into a switch, you could instead add
something else to fconfigure. Maybe fconfigure could return the last
result code. Then this tiny amount of information could be used by
developers familiar with channel programming to decide what to do.
Programming channels/sockets/fds with Tcl is easy because much of the
real complexity is removed, trying to add a little bit of it back via
switches is very short sighted. One other problem is that the call to
fconfigure could be well removed from the actual use of the channel
and the decision to handle the error.

I'm not sure this response is coherent, but looking at fconfigure, I
see channel configuration (get and set options), and at most
filtering. Exit code is not a filter, it is a branch. My argument is
that branch code should not be in switches. I think this is distinct
from constructs like try..., etc. where you make very explicit, in one
place, what is going on.

.



Relevant Pages

  • Re: Y&R - Channel 11 in Dallas/FW area
    ... Y&R - Channel 11 in Dallas/FW area ... I guess the switch to digital ... It looks like Channel ... 21 programming is also on Channel 11. ...
    (rec.arts.tv.soaps.cbs)
  • What the Digital Switchover Will Mean to Media Buyers
    ... households are not ready for the switch. ... senior vice president and director of programming at Carat ... What's the most important thing for media buyers and planners to keep ...
    (rec.arts.tv)
  • Re: Turning a light on and off with momentary switch
    ... Future applications will need to switch around 10W lights, ... One or two LEDs in series can be driven by some logic devices. ... FAIK RABBIT devices also requires programming which can be done using C. ...
    (sci.electronics.basics)
  • Re: Gadget Poll
    ... The turn off feature would be programmable at least to the extent were it ... One of the main advantages is to shut the transmitter down if the switch is ... My option would be to require that the transmitter switch be turned off then ... they could select in the programming. ...
    (rec.models.rc.air)
  • Re: [SLE] RedHat Amateur SuSe Newbie Question
    ... can anyone give me an objective reason to switch to ... It was already explained to you in the other thread you started that suse can ... > teaching Java Programming as well as Visual Basic Programming. ... students a disservice by teaching specific languages as opposed to general ...
    (SuSE)