gnu-arch-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Gnu-arch-users] Nit


From: Dustin Sallings
Subject: Re: [Gnu-arch-users] Nit
Date: Wed, 22 Oct 2003 11:58:20 -0700


On Wednesday, Oct 22, 2003, at 05:35 US/Pacific, Andrew Suffield wrote:

Since perl has no number types,

Totally wrong. Fundamentally so, even. Perl has three primitive
numeric types (two integer, one floating) plus a bunch of interesting
things done using magic, several of which are distributed in the core.

This is clearly a matter of perspective. The closest type perl has is a scalar which is sometimes interpreted as a number if the conditions are correct. In my example, "0" by itself is considered a number for the condition, but "0.0" is not. Math is possible on both of them. String manipulation is possible on both of them. In fact, the only way to tell if a scalar is a number is to perform string pattern matching operations on it. Languages with numeric types don't have this issue.

Only if you're a lunatic. These two statements:

"Replace functions with equivalents which succeed or die"

"Replace functions with equivalents which die on error"

are obviously not the same thing.

        Uh, yeah, obviously.

I've read the Fatal documentation carefully, and it most definitely
describes what it does accurately and precisely, and not what you say.

I've read the documentation carefully as well, along with the source. However, such modules shouldn't be so obscure that this is necessary. It gives open and close as examples. It should be safe to assume that read and syswrite can be used the same way. They cannot.

        Surely the authoritative online documentation should be considered
trustworthy.  It makes no suggestion that it is not the appropriate
tool for the job.  It seems to do quite the opposite, to me.

It makes no suggestion about appropriateness at all, and it almost
certainly shouldn't.

I agree, documentation *definitely* shouldn't give you a clue as to when you should actually do something, or even that it's a bad idea. It should only tell you that the particular thing being documented is a good example of how to do something and leave it to intuition to know that it's not good in practice.

Anyway, this whole perl topic has distracted greatly from the original point.

You said that only a moron would write code that doesn't check for all errors...er, unless it's writing to stdout or stderr since ENOSPC is obviously a temporary error and applications should queue up writes and try again later. Except yours since you specifically avoid checking the results in the first place.

Luckily, most of the languages I use will help with this situation. Python, ocaml, eiffel, java, etc... will quickly inform me with an exception when I attempt to perform a write and that write fails, regardless of file descriptor. Tom has provided a similar concept in hackerlab so write errors won't be dropped there, either.

Anyway, this isn't going anywhere. You won't convince me that it's OK to ignore errors based on file descriptor, and I won't convince you that the Fatal module is a stupid hack. Let's move on and get some actual code written.

--
Dustin Sallings





reply via email to

[Prev in Thread] Current Thread [Next in Thread]