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

[REBOL] Lit-words

From: lmecir:vol:cz at: 16-Nov-2009 22:57

Hi all, this theme pops up on this list from time to time. For some words the usual (apostrophe-prefixed) syntax (e.g. 'a) does not work. The most frequently seen idiom looks like: to-lit-word "/" to-lit-word "<" to-lit-word ">" to-lit-word "<=" to-lit-word ">=" to-lit-word "<>" etc. Disadvantages: *the obvious disadvantage of the above approach is, that it converts string to word, which is generally not recommended when the word is known in advance. (I have seen some quirks to occur just because a string is used) My suggestion: define a new AS-LIT-WORD function: as-lit-word: func ['word [any-word!]] [to lit-word! word] the above examples then become: as-lit-word / as-lit-word < as-lit-word > as-lit-word <as-lit-word >as-lit-word <> Advantages: *the new idioms are more readable *the code is faster *we get rid of the above mentioned quirks -L