[REBOL] UNTRAPPABLE ERROR!
From: robbo1mark:aol at: 26-Jun-2001 9:11
Whilst doing some research / thinking about
REBOL file! input-output functions like OPEN,
CLOSE, READ, WRITE etc and how they relate to
the ANSI C library file I-O functions, which REBOL
may? or may not? be built upon, and thinking about
how the REBOL refinements set options for the
file modes, eg read, write, binary, lines etc.
I made this "discovery" about a non trappable
error!.
Now before I go any further I know that the /lines
and /binary refinements are incompatible because
they refer to text files and binary files respectively,
and I was doing test cases for each possible combinations
and here is what I found......
>> open/binary/lines %test.txt
** ERROR: refinements lines and binary are incompatible.
Now I hadn't seen single line errors! of no type before
so I tried this.....
>> disarm open/binary/lines %test.txt
** ERROR: refinements lines and binary are incompatible.
>> disarm try [open/binary/lines %test.txt]
** ERROR: refinements lines and binary are incompatible.
>> ? disarm
USAGE:
DISARM error
DESCRIPTION:
Returns the error value as an object.
DISARM is a native value.
ARGUMENTS:
error -- (Type: error)
I couldn't trap this error with DISARM & convert it to an
error-object so I probed system/error to see if I could see
what was going on but it also doesn't seem to contain this
error! message.
Therefore I concluded that the 'OPEN function mut be doing
something like this internally.....
my-open: func [ file [file!] /lines /binary ] [
if all [lines binary] [
print "** ERROR: refinements Lines and Binary Incompatible."
halt
]
print "continuing with function operations"
]
The point here being that this error! string is written directly
to standard output and does NOT appear to return error! values in
the usual way as you might expect, this sort of behaviour SHOULD
be changed immediately but please watch out for it.
Has anybody else seen this problem or anything similar before?
Cheers,
Mark Dickson