Re: copying arrays



Kent M Pitman <pitman@xxxxxxxxxxx> writes:

... we teach people to be thoughtful about when a copy would help
and when not. Certainly we copy things. But we don't think to
copying as so important that it should be done by default all the
time; just the opposite, we think object identity is central and we
should think carefully about when to risk a separation of identity.

The OP seems to have expected (or at least wanted) SETF to make a copy
of the array. This might suggest a background in a language like Perl
or PHP, where the thing that looks like assignment actually does
something resembling a shallow copy (most of the time: sometimes it
does a CLRHASH or something like emptying a ring buffer). For a
variety of reasons, in these languages you often care only about how
things print, and so that kind of equivalence is usually more
important than object identity. Since EQUAL-but-not-EQ objects are
generally sufficient, and since these languages' libraries are mostly
full of destructive operations, it's idiomatic in these languages to
copy things literally all the time. That's not an argument for the
goodness of copying; it's just a comment about the expectations of
people with some sorts of background, and so about how Lisp would seem
strange to someone coming from those languages.

--
RmK

.



Relevant Pages

  • Re: Self function
    ... When he is copying a non-recursive function, ... _useless_ to do a search and replace. ... languages... ...
    (comp.lang.python)
  • Re: Armstrong and Virdings One Pass GC
    ... > generational GC for C which is optimised for such languages. ... We do have an accurate, copying collector, but that causes ... non-copying collector doesn't have these issues. ...
    (comp.lang.functional)
  • OOP, was Re: Programming Paradigms in Lisp
    ... Tim Bradshaw wrote: ... the only thing that all object-oriented languages have in common ... those mappings (and CLOS classes and generic functions are among the ... Without object identity, you are essentially stuck with a pure ...
    (comp.lang.lisp)
  • Re: Privilege-escalation attacks on NT-based Windows are unfixable
    ... >> a string you must allocate a new memory block to hold it. ... >> allocating a new buffer and copying both strings: ... that's whey in early languages the buffer for a string was 255 ...
    (comp.os.ms-windows.nt.admin.security)
  • Re: Privilege-escalation attacks on NT-based Windows are unfixable
    ... >> a string you must allocate a new memory block to hold it. ... >> allocating a new buffer and copying both strings: ... that's whey in early languages the buffer for a string was 255 ...
    (comp.security.misc)