User loginNavigation |
Is cloning independent of message-passingI was thinking about constructors in class based languages and how the idea might relate to prototype-based languages, when it occurred to me that if you try to create a prototype-language with message-passing, you'll have to define the basic "clone" operation outside of the message passing framework. Here's a brief description of the thoughts that brought me to this conclusion. I was considering how I might want to have some code execute whenever a object is cloned -- like a constructor in a class-based language. I could send an "init" message to each object right after it is cloned. But this doesn't describe the process of actually the cloning the object in the first place. So let me define a "clone" method which returns the new object. Let's say the clone method operates by creating a blank object and then adding the parent object's own members to it. But that raises the question: where do we get an empty object? It seems to me that the language runtime has to provide this empty object and that the semantics related to it have to be separate from the semantics for messaging. In other words: you cannot describe object creation purely in terms of sending messages to existing objects. I wanted to get this idea down in some form while it was still fresh, so it's possible that I'm missing something. I'm not familiar with the formal semantics for non-class-based languages, so if there are papers that contradict (or support) what I just said, please point me towards them. Thanks. By Shrutarshi Basu at 2010-10-07 22:31 | LtU Forum | previous forum topic | next forum topic | other blogs | 3585 reads
|
Browse archives
Active forum topics |
Recent comments
22 weeks 6 days ago
22 weeks 6 days ago
22 weeks 6 days ago
45 weeks 19 hours ago
49 weeks 2 days ago
50 weeks 6 days ago
50 weeks 6 days ago
1 year 1 week ago
1 year 6 weeks ago
1 year 6 weeks ago