[REBOL] Re: Obscure? You be the judge!
From: nitsch-lists:netcologne at: 15-May-2002 1:27
Am Dienstag, 14. Mai 2002 17:22 schrieb Cyphre:
> ----- Original Message -----
> From: "Volker Nitsch" <[nitsch-lists--netcologne--de]>
> To: <[rebol-list--rebol--com]>
> Sent: Tuesday, May 14, 2002 11:52 AM
> Subject: [REBOL] Re: Obscure? You be the judge!
>
> .............
> when you 'make an 'object!, all strings, blocks and functions are copied.
> that allows for example in 'layout :
> box with[append init[my-inits]]
> without destroying the original in box.
> also blocks, like functions, are rebound.
> so [make child-proto []] gives a copy of 'dataref, not the original.
> but objects are not copied,
> so the 'face/feel are all the same after [make face[]].
> ..................
>
> That's why lot of people are asking RT for adding something like 'clone or
> 'make/deep ;-)
>
I know.
> Or should it be a default Rebol's behaviour when working with objects?
>
Actually i like it the current way.
===cloning, complex structures
In my experience with other languages
cloning of complex structures gets pretty complicated
and automatics are not very helpfull there.
make/deep could manage one or two nesting steps maybe,
with more something usually needs to be shared and the language
needs constructs/conventions to control clone/sharing and the programmer
has to be aware of it. well, cloning is a bit like the last sentence ;)
Also Carl avoids it, so i expected my "trap"-view is right,
and rebol has a better "native" way.
Not necessary better as in 'good,
but as in "you know, if you open this other box..".
So for a while I started to chose between blocks/objects
based on my sharing/cloning decisions.
Just to see what happens.
And oops, its handy! Now it is a good commodity.
===constants, cloning deep faces?
Also if i know i modify an object, by default i make it.
about rebol its one sentence
if you want to modify it, its object!, its shared, so 'make it
,
other languages have nice keywords like 'constant.
and then 'mutable somewhere inside because the constant is not
so completely constant in a special case.
works, but another piece to keep in mind.
in c its a page of paper with some extra hints in specialized books
to use the constant-concept correctly.
(if you have a const pointer, is the pointed stuff const too or not?)
So if i want to scroll text in a face, i look
which object is affected, and use [area para[]].
(fortunally i discovered that somehow, because docs..)
==switching between blocks and objects
a: context[b: 123] a/b: 234 probe a/b
a: [b 123] a/b: 234 probe a/b
are very similar. and scripts short enough to change the other places ;)
> Regards,
>
> Cyphre
greetings
Volker