Bernhard Pfahringer wrote: > ACL comes with a specific deep copier, if you abuse their > fasl-file facilities (kind of what was hinted at for the Java solution):
> USER(2): (arglist 'excl:fasl-write)
The documentation says FASL-WRITE does not work for CLOS classes other than the built-in ones. MAKE-LOAD-FORM has to be used, requiring specialized methods.
Courageous <jkras...@san.rr.com> writes: > > > I can't write a specific graph copier, because I don't have a- > > > priori knowledge of the structure of the objects that I will be > > > copying.
> > Look, you can't write a general copier, get over it.
> Well, actually you *can* write a "general" graph copier if the > graph of objects is composed of objects made from a restricted > set of primitives.
ACL comes with a specific deep copier, if you abuse their fasl-file facilities (kind of what was hinted at for the Java solution):
-------------------------------------------------------------------------- Bernhard Pfahringer Dept. of Computer Science, University of Waikato G1.25, phone: +64-7-838-4041 bernh...@cs.waikato.ac.nz --------------------------------------------------------------------------
> > Well, actually you *can* write a "general" graph copier if the > > graph of objects is composed of objects made from a restricted > > set of primitives.
> Perhaps you should be clear about what you mean by `general'. Earlier > you said:
Oh. Okay. Well then, looking at the *very same message* that you quoted, but taking a slow gander at the part you deliberately cut out in order to score points, I see:
"however, stipulating certain rules on the structure of the objects may be within reason."
> A generic deep copy function is impossible because in order to copy an > object, you must know the meaning of the object and how it will be used.
I understand this. I guess I'm wondering what specific constraints have to be held to if you reasonably expect a graph-copy to work. I'm willing to build my objects out of specific primitives, but being new to lisp, don't know where I'm likely to make mistakes.
If there are many different data structures which cannot be deep copied, I'm okay with that. I can stipulate that these objects contain no such structures (checking that they indeed don't is another issue).
* Courageous wrote: > Oh. Okay. Well then, looking at the *very same message* that you > quoted, but taking a slow gander at the part you deliberately > cut out in order to score points, I see:
Believe me, I'm not trying to score points off you, or anyone. I should obviously have quoted the original article as the one that caused people to assume you wanted a truly general copier, but I didn't hit ^ enough times & just picked a bit that looked like it meant the same thing, which was stupid I realise. I won't quote the original now as you'll probably think I'm trying to win some stupid argument.
I'll repeat once more the things you need to write a copier (actually I notice I forgot to give one of them):
a notion of equality of objects
a method of saying if you've seen an object equal in the above sense to the one you are looking at now
a method of knowing which slots of an object you need to descend into to copy it. This depends on the semantics of the slots as well as their content (this is the one I failed to mention).
If your notion of equality is EQL or something similar, then the first two things are done very well by a hashtable, if it is more general then you need to write some hashtable-type thing.
`Knowing which slots' is application-dependent, but you can do stuff with the MOP to find them. I'd tend to do it with something like a map-interesting-slots generic function with progn method combination which I'd use to define the new interesting slots when I defined a new class.
> `Knowing which slots' is application-dependent, but you can do stuff > with the MOP to find them. I'd tend to do it with something like a > map-interesting-slots generic function with progn method combination > which I'd use to define the new interesting slots when I defined a new > class.
Yes. With the mop, you can traverse the slot definitions of a class, and with the right kind of code, you can iterate over each of these, recursively if need be. I have something similar (without the graph copying) implemented for non cyclic graphs. It was interesting to learn how to do this; I figured it out with _The Art of the Metaobject Protocol_.
Most of the reason I posted my question to the group was to make sure I wasn't reinventing the wheel. That, and my "copier" was originally intended to produce a plain text rendition of the object that followed certain formatting rules. Therein, I supported a set of basic primitives (boolean, integer, float, string), sequences (array, list, vector), and finally any standard-object. To understand how to correctly serialize boolean as "false" on my plain text serialization, I ended up having to have a look-aside table of metadata, which turned out to be necessary in any case (I forget why, but something to do with the types of sequence elements upon internal ization).
If this is just a case of doing what I did before, but with adding an objref and then using some kind of hashtable or something, I'm fine with that. I was hoping there was an implementation already out there...
* Courageous <jkras...@san.rr.com> | I mentioned the possibility of restrictions in my second message | in this very thread. Did you read it? No. Foo on you for that.
this is just great. of course I did that, and that's _why_ I criticize you for not doing it UP FRONT. perhaps you do ont know what "UP FRONT" means? well, it means you do it at the very start of your request for help. sort of like "I use XLISP, and have this problem" instead of just asking people to guess based on the lack of intelligibility of the problem as stated in the environments smart people use.
please go back to C++, both communities would benefit from that.
> > A generic deep copy function is impossible because in order to copy an > > object, you must know the meaning of the object and how it will be used.
> I understand this. I guess I'm wondering what specific constraints > have to be held to if you reasonably expect a graph-copy to work. > I'm willing to build my objects out of specific primitives, but > being new to lisp, don't know where I'm likely to make mistakes.
The very things you are saying here show that you don't understand. You're still completely missing the point. Any such constraints are _context_ specific, i.e., specific to the problem space, the various representations that you have chosen to to encode it, and what those representations _mean in the given context_. It should be completely clear that no general solution this is _possible_ no matter what set of "primitive" representations you are willing to restrict yourself to.
> If there are many different data structures which cannot be deep > copied, I'm okay with that. I can stipulate that these objects > contain no such structures (checking that they indeed don't is > another issue).
Datastructures are _completely irrelevant_. Of course you can copy _any_ datastructures (and vastly simpler, more easily correct, and cleaner in CL than you could even dream of doing in your wildest fantasies in C++), but that's the _easy_ part. Knowing which parts to copy, when to copy, and how to copy, is the important part and the part which is context specific and thus impossible to generalize in the sense you seem to want.
If you know what you are doing (see above) writing a completely general graph copier is pretty straightforward. For example, one of the aspects of our application is that graphs are first class objects - any kind of graph can be defined (with edge semantics specified and enforced, information propagation provided, etc., etc., etc.) and they can be freely manipulated. I wrote a completely general graph copier in about a page of code.
/Jon
-- Jon Anthony Synquiry Technologies, Ltd. Belmont, MA 02478, 617.484.3383 "Nightmares - Ha! The way my life's been going lately, Who'd notice?" -- Londo Mollari
> > The ELUGM '99 proceedings' index refers to a talk by you titled "One Step > > Beyond" without the corresponding paper (but someone in this group said > > that you had problems attending the event). The LUGM '99 proceedings' index > > lists another talk without paper titled "Creeping features".
> Creeping features & one step beyond are the same thing, and yes I > didn't make it to elugm. I'm not sure why it's not in the lugm-99 > proceedings, it should have been!
In my copy of the LUGM-99 proceedings, it is: "One step beyond, or Creeping metafeaturism" by Tim Bradshaw (10 pages). I enjoyed reading it.
OK, it is now at http://www.cley.com/articles/one-step-beyond.pdf. This is the original paper, I had hoped to do an HTML version which more closely corresponds to the talk I actually gave, but this is all there is for now.
> > ......................................... Knowing which parts to > > copy, when to copy, and how to copy, is the important part and the > > part which is context specific and thus impossible to generalize in > > the sense you seem to want.
> > If you know what you are doing (see above) writing a completely > > general graph copier is pretty straightforward. ... I wrote a > > completely general graph copier in about a page of code.
> However it is that you're reconciling these two paragraphs > is what I'm interested in. You say that it's not structure, > but semantics that indicates the meaning of a copy, and I'm > fine with that, too. It doesn't matter. I have a practical > problem to solve, here.
Well, then just go and write the silly thing. You are the only one (at least around here) that knows the specifics of your application context and thus the only one who can answer the semantic questions poised above and thus the only one who can write your specific graph copier. It should be a "yawner exercise".
> I'm not quite sure why in the part I cut out you felt a
Why not?
/Jon
-- Jon Anthony Synquiry Technologies, Ltd. Belmont, MA 02478, 617.484.3383 "Nightmares - Ha! The way my life's been going lately, Who'd notice?" -- Londo Mollari
> ......................................... Knowing which parts to > copy, when to copy, and how to copy, is the important part and the > part which is context specific and thus impossible to generalize in > the sense you seem to want. > If you know what you are doing (see above) writing a completely > general graph copier is pretty straightforward. ... I wrote a > completely general graph copier in about a page of code.
However it is that you're reconciling these two paragraphs is what I'm interested in. You say that it's not structure, but semantics that indicates the meaning of a copy, and I'm fine with that, too. It doesn't matter. I have a practical problem to solve, here.
I'm not quite sure why in the part I cut out you felt a need to describe the wonders of lisp to me. Do you get a lot of hostile-to-lisp posters here? I am someone who is voluntarily learning to use lisp, and as is I suspect of many first time users, I've found it so flexible and useful that most of my questions involve where its limitations lie.
When I say that something can be done in some other language with some particular mechanism, this isn't some sort of snide comment on the capabilities of lisp, but rather me pointing out that if an approach works in one language, there ought to be a way, no matter how labyrinthine, to achieve it in another.
> * Courageous <jkras...@san.rr.com> > | It doesn't matter. I have a practical problem to solve, here.
> thank you. I think this sums up your position admirably.
Yes, it does. Some of us do, in fact, work on real problems which need solving. Theoretical constraints are interesting and valuable to know, but the project moves on.
I suspect that you need to look inward and not outward to solve the problem that you need to work on. Usenet won't offer your ego what it's looking for, no matter how hard you look for it.
* Courageous <jkras...@san.rr.com> | Yes, it does. Some of us do, in fact, work on real problems which need | solving. Theoretical constraints are interesting and valuable to know, | but the project moves on.
just because you cannot fathom the theoretical implications of your questions does not mean that those who do don't solve practical problems. think about this. please.
and, incidentally, if I have "made" you feel like an idiot, why not just do something that would put such impressions to _shame_ instead of going out of your way to _prove_ that you really _are_ hopelessly lost?
| I suspect that you need to look inward and not outward to solve the | problem that you need to work on. Usenet won't offer your ego what it's | looking for, no matter how hard you look for it.
I'm sure you and your shrink have worked something out that works for you (although by the looks of it, you have some ways to go), but just like he or she should have told you that you shouldn't give other people your medication, you also shouldn't believe that your personal problems apply to other people.
but I'll give you this: you are indeed courageous. I know of few other people who would expose themselves the way you do. here's a hint: you really don't need to -- nobody cares about _you_, personally, and it's an affront to your audience, _any_ audience, to think they do.
On Tue, 11 Apr 2000 21:34:42 +0200, Arthur Lemmens <lemm...@simplex.nl> wrote:
> In my copy of the LUGM-99 proceedings, it is: "One step beyond, or Creeping > metafeaturism" by Tim Bradshaw (10 pages). I enjoyed reading it.
Huh... That paper is missing from my copy of the LUGM '99 proceedings... Does yours also include the paper by Chuck Fry listed as "Lisp in Space" in the index (i.e. the list of talks printed on a green sheet), and the one by Fred Gilham listed as "Dist. Transactions"?
Paolo Amoroso wrote: > Huh... That paper is missing from my copy of the LUGM '99 proceedings... > Does yours also include the paper by Chuck Fry listed as "Lisp in Space"
No, I can't find that one.
> and the one by Fred Gilham listed as "Dist. Transactions"?
Yes: "SDTP - A Multilevel-Secure Distributed Transaction Processing System" by Fred Gilham and David Shih (12 pages).
* Courageous <jkras...@san.rr.com> | You just can't stop, can you Erik?
if I can stop you, that's good enough for me, because I don't start the kind of insane drivel you seem to enjoy starting. but have you asked yourself your own question, lately? I don't appreciate your line of psychologizing crap, but now that you get it back in your face, I see that you are a lot more sensitive to the matter than I am, which is good, because you may realize that if you plan to win any games that way, you won't do it here, and you're clearly the kind of moron who needs to be hurt to stop to think. will _that_ make you stick to your issues, whatever they may be, or will you smear more of your personality all over the place with yet more moronic psychologizing and irrelevant personal attacks? it's your call, "Courageous".
In article <38F37055.3...@synquiry.com>, Jon S Anthony <j...@synquiry.com> wrote:
> Any such constraints are > _context_ specific, i.e., specific to the problem space, the various > representations that you have chosen to to encode it, and what those > representations _mean in the given context_. It should be completely > clear that no general solution this is _possible_ no matter what set > of "primitive" representations you are willing to restrict yourself > to.
Well, it depends on what you mean by "deep copy". The obvious meaning is that after a deep copy, you have two references that behave identically, but updates through one won't affect the behavior of the other (that idea can be formalized). Most languages can't implement this, but it's still well-defined.
> Of course you can copy > _any_ datastructures (and vastly simpler, more easily correct, and > cleaner in CL than you could even dream of doing in your wildest > fantasies in C++), but that's the _easy_ part.
No, in fact, some very common data structures in CommonLisp cannot be copied because they are opaque, among them closures and streams.
> Knowing which parts to > copy, when to copy, and how to copy, is the important part and the > part which is context specific and thus impossible to generalize in > the sense you seem to want.
Unlike equality, where it matters if you compare too much, for the semantics of a deep copy, it doesn't matter if you copy too much--it will simply be inefficient.
Automatic deep copy is actually a pretty common operation in dynamic distributed object systems and persistent object stores, and a number of systems do a very good job implementing it almost completely automatically. Even CL compilers end up having to be able to perform some pretty general deep copies.
> Automatic deep copy is actually a pretty common operation in > dynamic distributed object systems and persistent object stores, > and a number of systems do a very good job implementing it > almost completely automatically.
Having worked with distributed systems and object databases for 8 years now, I've noticed the same thing. Said systems do a lot of bending over backwards to fit a square peg into a round hole, but they get the job done.
> insane drivel... crap... in your face... you won't do it here... > and you're clearly the kind of moron... who needs to be > hurt to stop to think... moronic...
"Needs to be hurt". I especially like that one. With messages like this, the only person who's getting hurt is you. How embarrassing for you.
* tom 98 wrote: > Unlike equality, where it matters if you compare too much, > for the semantics of a deep copy, it doesn't matter if you > copy too much--it will simply be inefficient.
Actually, it does matter, especially if you copy things that should be equal so they stop being equal. If you copy things that not DAGs then this can not only fail to preserve the semantics of your data structure but fail to terminate, which is bad. Making things that are only incidentally equal remain equal is only bad for efficiency.