Hi,

> > I've been wondering what the reasoning behind REBOL's scoping
rules was for
> > awhile. In C, for instance, any variable that you declare in a
function is
> > "automatic" (that's what C calls them anyway :). They're
automatically local
> > to the function they're defined in, etc.
(...)
> > Why does REBOL have variables be globally scoped by default? I
ran into this
> > a few days ago when I asked the list for assistance, and
people helpfully
> > replied (thank you). One of the things people pointed out was
that I wasn't
> > being careful with my recursion and kept using the same global
variable over
> > and over again.
(...)
> > Anyway, I'd really like to understand why REBOL works the way
it does in
> > this respect, so if anyone has any insight to give I'd love to
receive it.
> > Thanks so much.
> >
> > Keith

In Rebol you need the core words to start writing the code (no
"reserved words" as in other languages). The core words are all
global and it would have been impossible to declare them as global
in every block. Other languages use a "trick" - the counterparts
of some Rebol global words are not globals, but "reserved words",
that are globally available without any declaration...

Ladislav

Reply via email to