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

[REBOL] Re: Introduction

From: carl:rebol at: 25-Apr-2001 9:08

You'll have fun with REBOL then. REBOL is like a lake. On the surface, it is simple for beginners. You can write a lot of "one liners" that do useful things. But, there is great depth to the language, as it is the result of 20 years and over 50 languages. Programs can be very sophisticated. Learn REBOL series. That's the basis for the entire language. If you learn series first, the rest will come much easier. Here are the biggest errors that you will encounter: #1: if condition [do this] [do that] IF is a function that takes only two args! The second block is just data and not processed by IF. Used EITHER or IF/ELSE. Why not give an error? Because you may have written: reduce [if a > b ["item"] [1 2 3]] #2: test: function [n] [m] [ m: "" insert m "!" print m ] The string is literal, it persists over all calls to the function. So, you need to do either: clear m to clear the literal, m: copy "" to copy it first, or: m: make string! 10 to dynamically create the string. This rule applies to literal blocks, and data within blocks too. So, if you need to reuse a block: b: copy [] b: make block! 10 clear b #3: And finally, REBOL uses *very* simple precedence rules, so you don't have to memorize ** comes before * before + before = etc. It's left to right. 5 + 3 * 10 = 80 TRUE. What's interesting is how many time I've found that evaluation order to work better than precedence rules. I did not expect that. It was a delightful result. Suppose I should post this to our site? -Carl