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

[REBOL] Re: ignore

From: ryan:christiansen:intellisol at: 26-Jun-2001 17:04

Yes, I agree using 'comment is the best way to go with this. Thanks for the advice! -Ryan Joel Neely <[joel--neely--f] To: [rebol-list--rebol--com]> cc: Sent by: Subject: [REBOL] Re: ignore rebol-bounce@ 06/26/2001 04:29 PM Please respond to rebol-list Hi, Ryan, We already have it. [ryan--christiansen--intellisol--com] wrote:
> Would it be useful to have a REBOL native word 'ignore? > > ignore: func [][] > >> ? comment
USAGE: COMMENT value DESCRIPTION: Ignores the argument value and returns nothing. COMMENT is a native value. ARGUMENTS: value -- A string, block, or any other value (Type: any)
> Why? Because it can be used in if error? try statements, like as
> if error? try [publisher-email-address: get-email-address page][ > ignore > ] >
if error? try [something here] [comment {ignore errors}]
> If the 'try block returns an error, I place 'ignore in the return block. > > Sure, you could use comments. > > if error? try [publisher-email-address: get-email-address page][ > ; ignore > ] > > But if for some reason you copy-and-past some code and the words wrap > incorrectly, you can inadvertantly comment out code you didn't mean to. >
Since the argument to COMMENT can be a string or block, you can protect yourself from line wrapping by using the argument's delimiters (as illustrated above).
> You could also simply have nothing at all in the return block. > > if error? try [publisher-email-address: get-email-address page][] > > But that doesn't "tell" you anything. Also, the brackets tend to sit > rather close in some fonts and can be overlooked. >
It seems to me that the whole reason for *having* comments is to tell you things. If you don't want to say anything about the situation, then why not simply say error? try [something here] and move on? -jn- It's turtles all the way down! joel'dot'neely'at'fedex'dot'com