[REBOL] Re: On mutability and sameness
From: joel:neely:fedex at: 7-Jun-2001 8:23
Hello, Volker,
Volker Nitsch wrote:
> Am 07.06.01, 00:07:53, schrieb "Larry Palmiter"
> <[larry--ecotope--com]> zum
> Thema [REBOL] Re: On mutability and sameness:
>
> > Hi Joel
>
> > > But it is equally inaccurate to assume that they are
> > > fixed-size
> > > scalar values, isn't it?
> > >
> > > >> foo: 9.8.7.6.5.4.3.2.1.0
> > > == 9.8.7.6.5.4.3.2.1.0
> > > >> repeat i 10 [print foo/:i]
>
> > >> foo: 1.2.3.4.5.6.7.8.9.10.11
> > ** Syntax Error: Invalid tuple -- 1.2.3.4.5.6.7.8.9.10.11
>
You're right. Experiments confirm that ten is the maximum
number of elements in a tuple.
> > The "scalar" types could be tagged pointers (references)
> > as suggested by Volker. A few bits in the pointer could
> > designate the type and whether the value is contained
> > within the pointer. As you probably know this is a common
> > way of implementing "scalar" types in Scheme.
...
> Ok, correction: max slot size 10 byte. Not much different
> to ~8 (around 8). ;-)
> i was speculationg a usual floating point number needs 8 byte,
> a pair! 2* 4-byte integer, so 8 sounded good.
>
> Well, with 16 bytes there is space for
> 1 native pointer/handle(4 bytes)
> + 10 bytes data
> + 2 byte something.
> some kind of type-description + tuple-length?
> i think this would be most simple to implement
>
Yes. This was what I referred to earlier as a "self-relative
descriptor". That technique has been around since the late
60's. A data value is represented by a descriptor, which
contains type information and a "pointer" to the data.
To save space and time, however, data which can fit into the
pointer
portion of the descriptor are placed there. There
are some variations on this theme. The decision as to where
to allocate the data storage may be determined solely by the
data type (e.g., integer). In this case, such data values
are not "sharable". OTOH, the decision may be deferred, in
which case there is a need for a separate bit in the
descriptor -- the "self-relative" bit -- that indicates whether
the data is inside the descriptor or simply referenced by the
descriptor. In this case, even "small" data values may be
shared.
The behavior we've been exploring is consistent with the idea
that REBOL uses a type-dependent descriptor, and implements
the refinements on DATE! values as special-purpose mutations
on the self-relative value.
-jn-
------------------------------------------------------------
Programming languages: compact, powerful, simple ...
Pick any two!
joel'dot'neely'at'fedex'dot'com