-richard- wrote: > --Forward References-- > "Sometimes a script needs to refer to a function before it has been evaluated. This can be done as long as the variable for the function is not evaluated before it is defined." > > How do you determine if the referenced function is "evaluated" before it is defined? Must you order all definitions within a file so that the definitions always come before reference is made to them? Any references/weblinks with clarification?
Here's an example from the console: >> f1: func [x] [print "F1" f2 x] >> f2: func [x] [print ["F2" x]] >> f1 4 F1 F2 4 Note that the function refered to by 'f1 refers to 'f2, and note that the function refered to by f2 isn't created until the next line. Here's new console session: >> f1: func [x] [print "F1" f2 x] >> f1 2 F1 ** Script Error: f2 has no value ** Where: f1 ** Near: f2 x Note that in the second line I _haven't_ defined 'f2, but instead 'f1 is evaluated. Note that Rebol says 'f2 has no value. Everything that applies to a console session applies to a script. I hope that helps! Andrew Martin ICQ: 26227169 http://valley.150m.com/ -><- -- To unsubscribe from this list, please send an email to [EMAIL PROTECTED] with "unsubscribe" in the subject, without the quotes.
