I have a question about the code that Russell
wrote to illustrate:
Let's contrast the two "files" below:
REBOL[]
memb: none ; "declared" at beginning of file, global
block: ["a" "b" "c"]
code: [print memb]
foreach member block
[
memb: member
do code
]
; EOF
; Now without the initial declaration
REBOL[]
; no global
block: ["a" "b" "c"]
code: [print memb]
foreach member block
[
memb: member
do code
]
; Is there a difference in machine overhead here? Is 'memb being "redeclared"
; in each loop or is it sort of cached. This may seem to be a subtle
distinction
'; in these days of "just do it", but in the case of several million loops,
it could
; make a difference.
Just wondering :)
Tim
memb is a "global" word. In each loop, it's value is set equal to the value
>of the foreach-internal word, member.
>
>Russell [EMAIL PROTECTED]
>----- Original Message -----
>From: <[EMAIL PROTECTED]>
>To: <[EMAIL PROTECTED]>
>Sent: Sunday, August 13, 2000 8:39 AM
>Subject: [REBOL] word
>
>
> > I am confused. Consider this small script:
> >
> > REBOL []
> >
> > block: ["a" "b" "c"]
> > code: [print member]
> > foreach member block [do code]
> >
> > Upon execution, I get :
> >
> > ** Script Error: member has no value.
> > ** Where: print member
> > >>
> >
> > I guess I have to use 'bind or 'use somewhere, but I'm not sure which
> > and how.
> >
> > Thanks for your help
> > --
> > Fantam
> >
> >
> >