From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f4fd2,23202754c9ce78dd X-Google-Attributes: gidf4fd2,public X-Google-Thread: fac41,15edb893ef79e231 X-Google-Attributes: gidfac41,public X-Google-Thread: 103376,15edb893ef79e231 X-Google-Attributes: gid103376,public X-Google-Thread: 114809,15edb893ef79e231 X-Google-Attributes: gid114809,public X-Google-ArrivalTime: 2002-01-21 12:31:42 PST Path: archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!supernews.com!pd2nf1so.cg.shawcable.net!residential.shaw.ca!news3.calgary.shaw.ca.POSTED!not-for-mail From: kaz@accton.shaw.ca (Kaz Kylheku) Newsgroups: comp.lang.lisp,comp.lang.ada,comp.lang.eiffel,comp.lang.smalltalk Subject: Re: True faiths ( was Re: The true faith ) References: <%njZ7.279$iR.150960@news3.calgary.shaw.ca> <3c36fbc5_10@news.newsgroups.com> <4idg3u40ermnp682n6igc5gudp7hajkea9@4ax.com> <76be8851.0201101909.9db0718@posting.google.com> <9jtu3u8cq92b05j47uat3412tok6hqu1ki@4ax.com> <3C3F8689.377A9F0F@brising.com> <3219936759616091@naggum.net> <3C483CE7.D61D1BF@removeme.gst.com> <3C4863C5.6040406@mail.com> <3C48AE35.BA38ED04@adaworks.com> <3C4A58B8.10304@mail.com> <3C4B720F.F77B2552@adaworks.com> <3C4BE556.7040707@mail.com> Organization: Psycho-Neurotic Institute for the Very, Very Nervous Reply-To: kaz@ashi.footprints.net User-Agent: slrn/0.9.6.3 (Linux) Message-ID: Date: Mon, 21 Jan 2002 20:30:39 GMT NNTP-Posting-Host: 24.69.255.206 X-Complaints-To: abuse@shaw.ca X-Trace: news3.calgary.shaw.ca 1011645039 24.69.255.206 (Mon, 21 Jan 2002 13:30:39 MST) NNTP-Posting-Date: Mon, 21 Jan 2002 13:30:39 MST Xref: archiver1.google.com comp.lang.lisp:24882 comp.lang.ada:19150 comp.lang.eiffel:5488 comp.lang.smalltalk:18373 Date: 2002-01-21T20:30:39+00:00 List-Id: In article <3C4BE556.7040707@mail.com>, Hyman Rosen wrote: >Richard Riehle wrote: > >> Hyman Rosen wrote: >>>Richard Riehle wrote: >>>> procedure Copy_Deep (Source : in T; Target : in out T); >>>> procedure Copy_Shallow (Source : in T; Target : in out T); >>>> >>>I dislike the notion of providing these methods as external interfaces >>>to a type. It seems wrong to me for a client to have to know what kind >>>of copy to use - that's the type's business to know. >> >> Well I don't like having an assignment statement that behaves in an >> unpredictable way when I use it. > > >I think we can agree on this with unbridled enthusiasm :-) > >> So I prefer having the copy semantics spelled out as clearly as possible. > > > This clarity assures me that, when I call a method, it will behave as > > I expected. > >But the user of a type generally isn't concerned with its innards. That is false. >Why would you take a simple concept like copying or assignment and >burden it with implementation details? If you were writing a sort >method for a conatiner, wouldn't you just call it "sort" rather than >"merge_sort' or "bubble_sort"? The semantics of copying an object are not transparent to the user in a way that choice of sorting algorithm is transparent. All sorting algorithms which ensure the same postconditions are effectively equivalent except for performance. Different ways of copying an object do not ensure the same postconditions. They are semantically different, in a way that may matter critically to the caller. Here is a slightly better analogy: do you want a stable sort or can you live with an unstable one? The difference is visible to the caller. If a stable sort is essential, but an unstable one is invoked, that is a mistake. There can be lots of other variations: what comparison function is used for the elements? Each function leads to a different sort. There are effectively as many sort operations as there are ways to compare the elements. Usually, we arrange for the caller to be able to specify the computation, so we can offer all of these sorts behind one interface. The function sorts, but the caller specifies *how*. It's the same thing with object replication. We can copy in various ways, the caller specifies *how*.