> > Here's your function slightly edited
> >
> > local-func: function [input][my-local-string][
> >     my-local-string:      ; This says make it so that my-local-string
refers
> > to the next value. (1)
> >         "that is local "     ; This says create a string value. (2)
> >     print append my-local-string input    ; (3)
> > ]
> >
>
> I think it's slightly confusing to say in (2) that the literal string
> "says to create a string value".  Instead, I suggest that in (2) the
> literal string IS a string value.  (If I had my geek hat on, I'd say
> something more complicated like "serves as a reference to the string
> that was created when this source code was loaded", bit I left my geek
> hat at home today... ;-)

Yeah, it probably is a bit confusing. I confused my contexts. I intended to
to convey the sense that Rebol "does it differently", especially compared to
a compiled language (which was the example), rather than attempting to
explain the deepest truths behind Rebol (which I'm not entirely confident
on). I should have made that clear. I sould have also made clear that my
meaning referred to what happens at load - distinguishing between might
happen when Rebol script is parsed as opposed to when Rebol values are
evaluated.

> Every time the function referred to by to local-func is evaluated,
> my-local-string is set to refer to THE SAME STRING, rather than a
> newly-created one.

This sounds like a nice description when you have the expectation that
functions always do something (their definitions) when they are evaluated.
That they carry out all the parts of their definition when evaluated. A way
of thinking that says "this function now has program control" so it has to
do something (which is quite reasonable to imagine). But I wonder if Rebol
necessarily sees functions like this? Are they perhaps a dialect that is
interepreted? I only ask this because I'm trying to shake of my normal
assumptions of what Rebol is doing when it evaluates a "function" which is
after all a Rebol value not something like machine instructions (another
guess!).

>  Therefore, mutations on the value of my-local-string
> (e.g., append, insert, remove, replace ) are continuing to operate
> on the same string which ORIGINALLY (at load time) contained
> "that is local ", but which has subsequently been modified with every
> evaluation of the function.
>
> I don't want to sound hypercritical here!  I'm really just thinking
> out loud about how to describe the behavior of literal series values
> in REBOL, as this sort of thing keeps coming up on the list.

Yes, I know. I've collected three useful descriptions of it on my tips page.
But I feel that at least two levels of description (absolute beginner/ not
an absolute beginner) could be useful - differentiated perhaps by one using
metaphor and the other describing "the truth"...

> You certainly described the correct solution in the remainder of your
> note, but I'm wondering if making a more explicit distinction between
> load time and evaluation time will help us explain this.

Well, I think Elan can tell you that he believes it would since this
distinction is made in "The Official Guide" (p230).

Brett.

Reply via email to