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

Document bug - [catch] There's a catch!

 [1/2] from: al:bri:xtra at: 6-Oct-2000 16:00


Joel wrote:
> > > I assume your [catch] was a faster way of addressing this same
issue, by simply passing the error resulting from an empty argument list back to the caller. Andrew (mistakenly!!) wrote:
> > It's a whole lot simpler and catches the error earlier and it runs
faster. Ladislav wrote:
> I would say, that your source is (as long as :make, :block!, :length?,
:repeat, :foreach, :insert, :tail are normal, unchanged natives) exactly equivalent to the same function not having [catch] refinement, because there is no Throw for it in the source.
>> transpose [[1 2 3] [a b c] 3]
** Script Error: Cannot use path on integer! value. ** Where: insert/only tail Column Row/:Index Ladislav, you're right! I've read the manual on this part, Page 268, 8-26 Function Attributes, and it reads: <quote> If the [catch] attribute is specified, errors that are thrown within the function are caught automatically within the function but (continued on next page) at the point where the function was used. This is useful if you are providing a function library (mezzanine functions) and don't want the error to be displayed within your function, where where it was called: </Quote> But it doesn't mention that this _only_ happens if 'throw is used in the body of the function or one of functions the function might call. I've sent this to feedback and docs @ rebol.com so they can fix it up. Andrew Martin Foolishly believing the documentation! :-) ICQ: 26227169 http://members.nbci.com/AndrewMartin/

 [2/2] from: lmecir::geocities::com at: 7-Oct-2000 1:47


Hi, I am sure, I didn't explain the things as they should have been explained. Here is the example, how the code could look: Transpose: function [ [catch] "Transposes Matrices" Matrix [block!] ] [ Results Width Height Column ] [ throw-on-error [ Results: make block! Width: length? Matrix/1 Height: length? Matrix repeat Index Width [ Column: make block! Width foreach Row Matrix [ insert/only tail Column Row/:Index ] insert/only tail Results Column ] Results ] ] Now an example use:
>> transpose [[1 2 3] [a b c] 3]
** Script Error: Cannot use path on integer! value. ** Where: transpose [[1 2 3] [a b c] 3] Cheers, Ladislav ----- Original Message ----- From: <[Al--Bri--xtra--co--nz]> To: <[list--rebol--com]> Cc: <[docs--rebol--com]>; <[feedback--rebol--com]>