[REBOL] Re: A hard question
From: lmecir:mbox:vol:cz at: 4-Feb-2001 9:35
Hi Elan,
it's fine, that you tried too. Here are my two tests (Larry asked me to post
them both someplace):
; Error test:
arg1: func [x] [return make error! x]
arg2: ["some error"]
probe disarm arg1 first arg2
The result is:
make object! [
code: 800
type: 'user
id: 'message
arg1: "some error"
arg2: none
arg3: none
near: [return make error! x]
where: none
]
; Return test:
arg1: func [[throw] x] [return x]
arg2: [1]
test1: does [arg1 first arg2 2]
test1 ; == 1
test2: does [hard :arg1 arg2 2]
test2 ; == 2
Due to the "second class nature" of Rebol errors, HARD cannot pass both
tests IMO. (You can have a look at: http://www.sweb.cz/LMecir/rep.html)
> Hi Ladislav,
>
> looks like fun.
>
> What if we upgrade Larry's function as follows?
>
hard: func [x y][
if error? set/any 'error try [
do reduce [x first y]
][
return :error
]
]