[REBOL] Re: variable scopes and recursive func
From: greggirwin::mindspring::com at: 12-Apr-2005 14:31
First, it's great to see some new faces here! The lack of responses
from the "regulars" is due to a lot of traffic shifting to AltME
worlds, IOS servers, and some people testing GoogleGroups as an
alternative to the ML (which has had issues for a while, but seems to
be recuperating a bit as of late).
"Using Rebol requires that a programmer become familiar with
several new and innovative features that can be quite confusing"
I'll respectfully disagree with Bernie about that. A lot of people,
myself included, have used REBOL very effectively without knowing that
any of those advanced features even exist. It *can* be confusing if
you happen to be unfortunate enough to do things that bring it into
play. For a lot of people, they're never even aware of it, much less
caring about how it might work. That's part of the design (IMO).
The ones who get hit with it, like Janeks, tend to be programmers who
are used to other languages, as Bernie said. We kind of expect things
to work like they do elsewhere and it makes it hard to visualize
what's going on. The problem for those of us that want to understand
how all these things really work lies in letting go of old notions, or
trying to equate how REBOL works to how other languages work (e.g. to
understand binding, we might be tempted to try and write a little
interpreter that works like REBOL does; we're just sick that way :).
Ladislav's articles offer the most in-depth binding info out there; no
contest. All his articles are well worth reading:
You can nearly always, in normal use, think of context in terms of
scoping rules in other languages. The big things that can trip you up
are the "hidden context" that functions have (which is why local
series values persist between calls), and passing around blocks that
are evaluated in different contexts.
The case of using REPEAT with a recursive function isn't so much a
context/binding issue, in my mind, as an issue of REPEAT's behavior.
More in-depth info on binding would be helpful to some people, but I
would guess most REBOLers really don't need to know anything about it;
the rest of us can ignore it most of the time too. :)
If you have specific examples that could be used to explain binding,
or that are problematic, that would be good to know.
BS> And now, with important new features like Rebol/Services coming
BS> out that depend heavily on an understanding of contexts, I'm
BS> afraid that I'm going to be completely left behind in such areas.
Assuming you don't get tricky, I don't think you'll really need to
understand much about contexts, except to think of them as namespaces.
I wouldn't worry. LNS is intended to be used by people who don't care
about networking protocols or binding.
BS> For example, Rebol's parsing is one of these powerful, but
BS> unfamiliar features to those of us steeped in regular
Yup. Studying BNF and things that use it is the biggest help IMO.
BS> I hope that I'm coming across as being constructive here.
Absolutely. Great post.