james anderson <james.anderson@...> writes:
> On 2010-04-27, at 00:00 , Paul Khuong wrote:
>> In article <2AD8B06E-6490-40A6-B964-EE7D1D6B13AA@...>,
>> james anderson <james.anderson@...> wrote:
>>> On 2010-04-26, at 21:45 , Paul Khuong wrote:
>>>> In article <326E39EE-65BE-4D2A-BCCA-ACC72643B8D5@...>,
>>>> james anderson <james.anderson@...> wrote:
>>>>> On 2010-04-25, at 22:56 , Paul Khuong wrote:
>>>>>> The problem is that this breaks object identity. The semantics
>>>>>> of CL
>>>>>> dictate that, given A an array of TEST, I can do
>>>>>> (setf (aref A 0) (aref A 1))
>>>>>> and both indices should point to the same (wrt object identity)
>>>>>> For instance, side-effects to the structure in either index
>>>>>> will be
>>>>>> reflected in the other.
>>>>> Where is this constraint specified?
>>>> What constraint? That the implementation won't copy objects behind
>>> i'm more concerned with "before your very eyes."
>>> that is, is it anywhere specified that a conforming implementation
>>> could not define the behavior of simple-array to include structures.
>>> with the same consequences as for floating point numbers.
>> EQ is defined to work on structures, unlike numbers.
> ? i thought eq was specified to work on any object, but that is a
> secondary issue, as the direct concern is with places.
> while there is discussion under the topics of generalized references,
> symbol-value, and eq which implies that copying can not occur when
> symbol-value is used as a place, i still have not found any
> discussion which requires that with respect to aref. not even for
> general arrays.
> i am as surprised to not find it as you appear to be that one would
> suggest that the behavior which you expect is a matter of convention
> not specification.
AIUI, this is a general property of places. Refering the glossary:
place n. 1. a form which is suitable for use as a generalized
reference. 2. the conceptual location referred to by such a
generalized reference n. a reference to a location storing an object
as if to a variable. (Such a reference can be either to read or
write the location.) See Section 5.1 (Generalized Reference). See
Since (aref a 0) is a place, it should behave as a variable.
If you allowed copies of structures when storing into (aref a 0), then
you would have to allow such a copy when binding a variable too.
Indeed, I cannot find wording forbidding it, unless you understand the
possibility given to copy numbers and characters as exclusive.
On the other hand, variables are bound to objects, they are not the
receptacle of copies of objects:
binding n. an association between a name and that which the name
denotes. ``A lexical binding is a lexical association between a name
and its value.'' When the term binding is qualified by the name of a
namespace, such as ``variable'' or ``function,'' it restricts the
binding to the indicated namespace, as in: ``let establishes
variable bindings.'' or ``let establishes bindings of variables.''
Therefore we can argue that this wraps it up and that you cannot copy
lisp objects such as a structure into an array slot (only character and
numbers may be copied there and elsewhere).