Hi Bernie,
I'm not even sure whether the binding and context stuff is so
incomprehensible. I somehow just have the feeling that its hard because:
1) it's not treated properly and explained well enough from RT side (most
probably not to confuse beginners)
2) the bindings are not very visible, one has to have quite some
understanding of the Rebol evaluation model and when it binds what, in
order to get it
1) could be resolved to a certain extend by more tutorials, on the other
side I think Rebols way of being makes the dynamic binding necessary. I
don't think it's just to put some more power to the people. E.g. that's
why I was asking/thinking that 'repeat wouldn't be possible without the
dynamic binding. If it would be a build in keyword the interpreter could
use special semantics for it and the binding of the repeat-word could be
hidden better. But as it's just another function and could be equally done
yourself one has to have the possibility to bind a word like repeat-word
to the repeat-block and thus change it.
An interesting question is why for simplicity reasons some things aren't
used by default. E.g. always copy the repeat-block before use. Always use
closures for the functions. This way for a normal person or newcomer some
unexpected effects could be removed. This might a bit contradict the Rebol
philosophy, but as Carl once told in one of the blocks, the default
functions look like this so it's easier for people to lern Rebol as it has
a certain functional style which people know.
I'm also not so sure whether it is that easy to just put the bindology to
the advanced Rebol section, as it happens every now and then that it also
occurs in simple problems as well.
2) I don't know how the visibility could be improved. Most probably it's
just like that. :-) E.g. I was a few days ago checking out once again
Ladislavs closure function 'cfunc, because I forgot a little how it works
and was for some time puzzled by the last line before the return:
result: default [make function! spec result] 'error [throw error]
--> change second :result [do make function!]
There is this funny thing that when result: .... is evaluated one has
already a function like
result: func [x] [do make function! [some stuff...]
So what does the last line really do. Just exchanges the three words 'do
'make 'function! again. Now I know that it's just to enable one to use
these words as parameters to the function one wants to define, as the
exchanged words are not anymore bound to the result-function, but to the
constructing function(This is demonstrated there in an example in the
cfunc.r file). What I wanna say is that the binding fun isn't visible
exept one knows how something is going to be evaluated and bound to what
when.
Just to illustrate this funny thing.
f: func [a b c] [print [a b c]]
a: 5
b: 6
change second second :f [a b]
f 1 2 3
output-> 5 6 3
So I would like to know what reasons speak against making some of these
things by default behave more like other lexically scoped languages. (as
said above always use closures, copy/deep blocks when they get modified)
If the reason is just speed, there could be two versions, one for the
average person which doesn't yet have the full glue or simply doesn't care
and one which might be faster but one has to know the inner workings.
Ok was a bit long mail. Sorry for the readers. :-)
Michael
On Tue, 12 Apr 2005 13:38:01 -0400, Bernie Schneider
<[EMAIL PROTECTED]> wrote:
>
> Hi,
>
> I agree with you Michael. The subject of Rebol scopes, contexts,
> and bindings for me is the single most unclear and confusing
> aspect of Rebol. Using Rebol requires that a programmer become
> familiar with several new and innovative features that can be
> quite confusing, even, or maybe especially, for programmers with
> a lot of experience using other languages.
>
> For example, Rebol's parsing is one of these powerful, but
> unfamiliar features to those of us steeped in regular
> expressions. But
> I've found that with a lot of practice and with the steadily
> improving documentation on the subject, that I can get more
> parsing challenges mastered that I could at first. But with
> Rebol's context and binding concepts, I'm afraid that I'm no
> farther along in my understanding than I was when I first
> started several years ago. I just can't find any documentation
> on this important Rebol feature that takes into account the fact
> that I've never encountered anything like it in any of the
> dozens of languages that I've worked with before. And now, with
> important new features like Rebol/Services coming out that
> depend heavily on an understanding of contexts, I'm afraid that
> I'm going to be completely left behind in such areas. I think
> that it's important that RT try to make a significant effort
> to clarify bindings and contexts for those of us (and I don't
> believe that I'm alone here) who just don't get it yet.
>
> I hope that I'm coming across as being constructive here. I
> really don't mean to sound too critical. I'm just trying to
> point out that these issues aren't as clear to some of us as
> some others might think, and that some further attention in the
> form of documentation and maybe some in-depth tutorials would be
> of great benefit to the Rebol community.
>
> Regards,
>
> Bernie Schneider
>
> The individual has always had to struggle to keep from being
> overwhelmed
> by the tribe. To be your own man is a hard business. If you try
> it, you will
> be lonely often and sometimes frightened. But no price is too
> high to pay
> for the privilege of owning yourself.
>
> -- Friedrich Nietzsche --
> ----- Original Message -----
> From: "Michael Berg" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Sunday, April 10, 2005 6:03 PM
> Subject: [REBOL] Re: variable scopes and recursive func
>
> ================== SNIP ===================
>
>>
>> Just a question to somebody who might know: One of the reasons
> why the
>> binding mechanisms of Rebol are necessary is to make the
> keywordlessness
>> possible, else something like 'repeat wouldn't be possible,
> right ???
>> But nevertheless I think these binding issues should be one of
> the first
>> things to be explained to a newcomer. It is an important
> property of Rebol
>> and should be treated like this. If there are chances to
> encounter these
>> things in normal life they have to be explained appropriately
> already on
>> the beginning and not on some articles (Ladislavs Bindology)
> or some
>> sidenote in the documentation that a function changes it's
> body argument.
>> Without deeper glue of Rebol it's hardly to get the reason and
> just simply
>> using hints like using copy/deep on a block in some
> circumstances is hard
>> to remember and hard to explain. Thus if Rebol is like this it
> should be
>> put on the frontplate. ????!!!!
>>
> ================ SNIP =======================
>
>
>
--
To unsubscribe from the list, just send an email to
lists at rebol.com with unsubscribe as the subject.