Re: copying arrays



Espen Vestre <espen@xxxxxxxxxx> writes:

Q <qalex1@xxxxxxxxx> writes:

How do I pass copies of the array around, instead of the array
itself? I don't want them to be eq. But, it'd be nice if they were
equal :)

I use copy-seq, but note that copy-seq always makes a simple-array
(which is something I discovered just last week... I needed a fill-
pointer in both the original and the copy).

I find it oddly amusing to see the phrase "it'd be nice if they were equal"
given that it's not obvious to me what equal means.

There are many equality predicates. Why is equal, whose semantics are
relatively arbitrary, the one that copying should try to be faithful
to. It seems to me that this confirms my initial feeling that equal
should not have been in the language, because it encourages people to
see it as canonical, when it is not. People grab it as a highly blunt
tool for use in circumstances where they don't care a lot. And it
suffices for that. I suppose we could have an equally blunt copy
function. But it would just lead to more people confusing themselves.
For an awful lot of things, both of these tools fall short.

Ok, I don't really misunderstand how and why people use blunt tools.
We're probably optimized for it. But let me say it a different way:
It's rarely the people who understand that culture of how to make good
on blunt tools who complain. The complaint about the absence of copying
often comes from people with languages that do more static type checking
and pay more lip service to notions like formal semantics than Lisp does.
And I find it curious that a discussion which begins from a belief that
side effects are bad for some theoretical-sounding reason can so quickly
lead to a conclusion that having a relatively arbitrarily defined copy
function would be good. It's hard to see how to build a coherent anything
atop semantics of the arbitrary.

I guess it's like all abstracts--truth, justice, etc. It always seems
so obvious to us what they are. But, of course, it's really not.
.