[REBOL] Re: Block Creation Re:
From: brett:codeconscious at: 23-Oct-2000 16:48
> > I initially expected something else from point 12. At first I
> > thought "Chain of references" to mean some sort of data structure
> > held together with pointers, when actually it appears you were
> > showing how a series reference can get passed around.
> That's a good point. I was really thinking of something like
> "chain of assignments" but couldn't say that, as we don't have
> an "assignment" operator in REBOL! ;-)
> Perhaps I should have said "This behavior does not depend on how
> or when the reference to the block was obtained." Do you think
> that works as well or better?
I must say I'm not sure. I think the problem is that the word "reference" is
a heavily loaded term and here is doing double duty. In one case it means a
series reference (in a value sense) in another it means a word referring to
a series (in a set-word sense). There could be more.
> > Point 13 say "a shared series reference is being modified".
> > Your point is well made, but I would have expected the phrase
> > "the same series is being modified" was more accurate.
> My first attempt could stand some rewording here as well!
> I avoid saying "the same series" because I consider it misleading.
> What is the relationship between A and B in each of the following?
> >> a: [1 2 3] == [1 2 3]
> >> b: a == [1 2 3]
> >> same? a b == true
> >> b: next a == [2 3]
> >> same? a b == false
> >> append a 4 == [1 2 3 4]
> >> b == [2 3 4]
> To my mind a "series" requires both a sequence of data values and
> a position within that sequence. In the second set of expressions
> above, I would contend that A and B *are not* the "same series",
> both because REBOL says they're not, and because the position of
> each is different.
Down this route you probably should add that "series" has behaviour as
well - since hash! reacts differently to block!
I personally won't though! :)
>Unfortunately, the term "sequence" is not
> politically correct REBOL terminology, so it's awkward to describe
> the relationship!
> If I try to use more precise language, I end up talking about
> two series values that refer to the same data sequence (whether
> at the same position or not), and my sentences start sounding
> too convoluted for my taste. I'm still working on this one.
I see your point. I think for simplicity of description your really have to
add another name to describe what is going on. To finally get the concept
into my head I created for myself the term "series handle" - a handle on the
series that can slide up and down the series. That way I can understand that
I can have other handles on the series and have them in different positions.
I agree that Rebol calls this type a series!, but in my mind something of
type series! is not the actual series... Oh well, it works for me but I look
forward to the results of your futher work on this one :)
> That said, I'd be interested in how to use the "signifier/signified"
> model to describe this:
> >> a: == 
> >> b: reduce [1 a 2] == [1  2]
> >> c: reduce [3 a 4] == [3  4]
> >> a: reduce [b c] == [[1  2] [3  4]]
> >> append b/2 "Hi!" == ["Hi!"]
> >> a == [[1 ["Hi!"] 2] [3 ["Hi!"] 4]]
> The point being that there doesn't have to be a "name" or "word"
> to act as a signifier!
Ok, but you won't have anything signified!
> It is entirely possible to have data
> structures with shared references (or "with references to series
> values that refer to the same sequence") which exhibit the
> "sharing surprise" without there being any names for the
> shared parts.
Most definitely, but how then will you refer to that shared thing? You
cannot directly, but relative to something else - something with a
Do you remember Prince's experiment with a no-name status? It was very
annoying on the radio because everyone had to keep referring to him as the
man "formerly known as Prince" ( a relative reference). If he had supplied a
raspberry sound to use when referring to him that would have been the
signifier a -"pffft".
Here's the last line of your eaxmple:
a == [[1 ["Hi!"] 2] [3 ["Hi!"] 4]]
How do I know that you have a block that can exhibit the sharing suprise?
Because I followed the example in my head with my mental model, or I tried
it out in Rebol. The text of Rebol's response in the last line of your email
gives no clue that Rebol has in its model a structure with two references to
the same series. But it was the best Rebol could do to explain back to me
the structure it created. It is relying on me having an accurate mental
model to understand its response.
So here's an alternative pehaps silly way to introduce all this.
Rebol interprets the words you in at the console to build a model in its
that resembles the model you describe. If you type  Rebol "thinks" of
empty block. If you had typed my-block: , Rebol thinks of an empty
and accepts that the fact that you want to refer to it whenever you use
"my-block". Borrowing a concept from communications theory you might
empty block the "signified" and the word "my-block" as the "signifier".
Later you may
decide that you want another word to refer to the same empty block so in
can refer to the empty block using the name you gave it earlier - like
this empty-block: my-block.
Doing this means you have two signifiers for the same signified.
You can refer to blocks in another way. You can use another block!
Blocks are special.
They remember values. They remember value in the order that the values
were given. You can
get a block to remember a number of values like "[apple pear orange]".
But this is not enough,
if you don't give the block a name it will be forgotten. So this is
better fruits: [apple pear orange].
Blocks can remember other blocks like this
snacks: [chips biscuits chocolate-bar]
grocery-list: reduce [ fruits snacks fruits]
Why did I put fruits in twice? - I like fruit.
What happens if I decide that fruits should include banana? Well that's
ok because grocery-list
remembers I wanted fruit list entered twice. So I just change fruits
append fruits 'banana.
So what is happening here? grocery-list is not remembering the
individual fruit it is instead
remembering that I said I wanted a list of the fruit list first, then
the snack list and then the
fruit list again. A list that has three references to other lists, but
in which two of the references
refer to the same list.
And so on...
With my description I tried to give a flavour of my thinking as opposed to a
watertight model. Though, I believe it still has value as a way of looking
at what is happening.