Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search

[REBOL] Re: Help me, Obi Reb Kenobi, you're my only hope!

From: lmecir:mbox:vol:cz at: 2-Sep-2002 10:19

Hi Gabriele, Romano, myself and others, when I said: <<L>> IS-REALLY-ERROR? function works for simple code like above, but, AFAIK, we cannot handle all possible cases, like e.g.: is-really-error? [1 first block2] ; == true (until errors will be "first class")" <</L>> , I was wrong. Here is a (complicated, but working) version of the DEFAULT function, that can handle it: do default2: transp-func [ code [block!] fault [block!] /good pass [block!] /local result error code2 ] [ transp-while [not tail? code] [ code: if error? set/any 'error try [ set/any 'code2 second do/next compose [ error? set/any 'result (code) ] skip code (index? code2) - 3 ] [tail code] ] either error? get/any 'error [ fault: func [[throw] error [error!]] fault local-return fault error ] [ do any [pass [local-return get/any 'result]] ] ] block2: head insert copy [] try [first []] default2/good [first block2 1] ["error"] ["pass"] ; == "pass" default2/good [first block2] ["error"] ["pass"] ; == "pass" default2/good [first []] ["error"] ["pass"] ; == "error" Ciao Ladislav