Stephen Pelc wrote:
> > Posted by: "Bernd Paysan" bernd.paysan@... berndpaysan
> > If you relax your proposal in such a way that IORs must be throwable,
The proposal is now in the CfV stage and therefore frozen, so it
cannot be revised in any significant way. Someone could do an
alternative proposal that addresses the same problem, though.
> The proposal does not say that you *must* use these numbers, it
> says that if you use these numbers, this is what the standard
> means by those specific numbers. Consequently gForth will not
> conflict with the proposal.
So if ALLOCATE returns an ior value of, say, -524 if it fails, would
you see that as an implementation of your proposal?
> > I like to keep as much information as possible about the
> > original error, so mapping errors to words that
> > misbehave isn't such a good idea - a word like
> > WRITE-FILE can fail for quite a number of reasons (no
> > space left on device, pipe closed, low-level IO error,
> > buffer outside address space, etc.). A backtracing
> > utility is a better way to locate the error, and you'll
> > then see which word misbehaved, as well.
>
> Given the range of hardware and O/S, it is impossible in a
> standard to go beyond saying that WRITE-FILE failed and a THROW
> occurred.
It's not necessary to go beyond. It's not even necessary to go that far.
It's only necessary that the values returned as iors by standard words
make sense as THROW values. E.g., if the system returns -540 for a
failed WRITE-FILE, then -540 THROW should produce a sensible error
message (like "No space left on device") when the system catches it.
But that's a requirement that I don't see in the proposal.
The difference the proposal should make is between:
Wrong (pfe-0.9.14):
s" /etc/xxx" w/o create-file .s
2 [0000000000000002]
0 [0000000000000000] ok
throw
Error: "throw" 2 THROW unassigned
throw
^
Better (pfe-0.33.34):
s" /etc/xxx" w/o create-file .s
13 [0000000D]
0 [00000000] ok
throw
Error: Permission denied : "throw"
throw
^^^^^^ ok
But still not quite there, because 13 is not in the range of
system-defined throw codes.
Good (gforth-0.6.2):
s" /etc/xxx" w/o create-file .s <2> 0 -525 ok
throw
*the terminal*:2: Permission denied
throw
^^^^^
Backtrace:
- anton