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

ignore

 [1/5] from: ryan::christiansen::intellisol::com at: 26-Jun-2001 15:16


Would it be useful to have a REBOL native word 'ignore? ignore: func [][] Why? Because it can be used in if error? try statements, like as follows... if error? try [publisher-email-address: get-email-address page][ ignore ] 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. 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. Thoughts? -Ryan

 [2/5] from: joel:neely:fedex at: 26-Jun-2001 16:29


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 follows... > > 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.
<<quoted lines omitted: 3>>
> 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

 [3/5] from: petr:krenzelok:trz:cz at: 26-Jun-2001 23:47


----- Original Message ----- From: <[ryan--christiansen--intellisol--com]> To: <[rebol-list--rebol--com]> Sent: Tuesday, June 26, 2001 10:16 PM Subject: [REBOL] ignore
> Would it be useful to have a REBOL native word 'ignore? > > ignore: func [][] > > Why? Because it can be used in if error? try statements, like as
follows...
> if error? try [publisher-email-address: get-email-address page][ > ignore > ]
If you don't want to have your own mezzanine, you could probably use: none or does [none] it is readable enough ... on the other hand having another standard mezzanies would not hurt, e.g.: ->> time-of: func [time][fourth time] ->> time-of now == 23:36:57 ->> words-of: func [object][next first object] ->> probe words-of system ->> values-of: func [object][next second object] ->> probe values-of system ; better don't do this one :-) if not exists? - it is not correct english, you could easily define: ->> doesn't: :not ->> exist?: :exists? ->> if doesn't exist? %/C/ble.txt [print "ble.txt doesn't exist :-)"] ble.txt doesn't exist :-) Sometimes as the most confusing concept of Rebol seems to be polymorphism. Typical example is 'first - it can be used in many situation, with different results (first on series, first on object, first on function, first on port, first on routine, structure ....) -pekr-

 [4/5] 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] edex.com> cc: Sent by: Subject: [REBOL] Re: ignore rebol-bounce@ rebol.com 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
follows...
> 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.
<<quoted lines omitted: 3>>
> 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

 [5/5] from: jelinem1:nationwide at: 26-Jun-2001 17:34


This is trivial by definition. Then again, so is the number zero. Actually comments would be more descriptive in the case you described. If you're worried about line wrap (under those esoteric conditions?) then you don't even have to use real comments. REBOL lets you state a bare string with no operations and won't complain, so you can use the multi-line string syntax for these comments. Of course this will give your block a return value; after your "comment string" just place the word 'none. Now that I think about it, 'none can probably be used to just as great an effect as your idea for 'ignore. I do see what you're getting at and I agree with your thinking (making code more readable and explicit), I just don't think we need another "trivial" native for this.
>> ignore: none
however, interestingly enough (in /Core 2.5):
>> alias 'none "ignore"
** Script Error: Alias word is already in use: ignore ** Near: alias 'none "ignore"
>> help ignore
No information on ignore (word has no value) Have you stumbled onto something here? What's the deal? - Michael Jelinek From: [ryan--christiansen--intellisol--com]@rebol.com on 06/26/2001 03:16 PM Please respond to [rebol-list--rebol--com] Sent by: [rebol-bounce--rebol--com] To: [rebol-list--rebol--com] cc: Subject: [REBOL] ignore Would it be useful to have a REBOL native word 'ignore? ignore: func [][] Why? Because it can be used in if error? try statements, like as follows... if error? try [publisher-email-address: get-email-address page][ ignore ] 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. 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. Thoughts? -Ryan

Notes
  • Quoted lines have been omitted from some messages.
    View the message alone to see the lines that have been omitted