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

[REBOL] Re: What does REBOL fix?

From: maximo:meteorstudios at: 17-Dec-2003 20:23

a twist on my previous statement... REBOL: others define code, rebol expresses it and a new one: REBOL: its quick and dirty... without the dirty --------------------------- DRIFTNG A LITTLE BIT... --------------------------- In this ongoing discussion, it has been confirmed that you can evaluate code "on-the-fly" in most modern languages, or have modules or extensions which allow it. But rebol, being an expression parser and evaluator, handles code in many ways like if it where any kind of mathematical expression. This means evaluating code on the fly is INTRINSIC to rebol... its not just a feature. no one marvels when they know that their language can calculate an expression with functions and variables: b = (x + abs(x) + 45) / 2 here each parenthesis will eventually receive a value once its internals have computed and will get a numerical value. in the above, execution is impossible without defining x, right? I mean, any computer programmer will react instantly and say: "of course!". Many rebolers have yet to realise that rebol actually handles all data in much the same manner, relatively speaking. Code being just another type of data to handle. Defining, evaluating, passing, and assigning values to/from words as it encounters them. warning: The following code and explanations is a little more advanced, and is an excellent primer for those of you who want to get in on the more "obscure" (advanced) functionalites of rebol! If you don't understand the following, you should look up each word in the help and try to understand it piece by piece. It might open up your understanding of all that jabbering, the more experienced rebolers have been doing. ;-) type this in the rebol console:
>> hello: do prints: func [arg][does compose [print (arg)]] "hello world" >> hello
hello world Each thing in the expression is evaluated one by one like a mathematical expression. here, the word PRINTS eventually got a value while rebol was evaluating the expression line, so we can then try:
>> bye: prints "bye bye" >> bye
bye bye bye and hello really are new functions, as proven here:
>> source hello
hello: func [][print "hello world"] This shows how you can create you own custom "statements", as defined in other languages. conclusion: ----------- Yes, many other languages support on-the-fly eval() of code, but to get that back right in the language without any additional effort, to be able to play with code like data, to assign contexts to words, store them, generate new functions using these contexts and all the manner of advanced modifiable code, IMHO rebol is the current (easy and fast to use) king of the hill... HTH! -MAx dont be fooled. Simple is hardest