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=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=ham 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-24 00:14:39 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!canoe.uoregon.edu!cyclone1.gnilink.net!spamfinder.gnilink.net!nwrddc01.gnilink.net.POSTED!53ab2750!not-for-mail Message-ID: <3C4FC2FF.7000103@mail.com> From: Hyman Rosen User-Agent: Mozilla/5.0 (Windows; U; Win 9x 4.90; en-US; rv:0.9.7+) Gecko/20020111 X-Accept-Language: en-us MIME-Version: 1.0 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> <7302e4fa4a.simonwillcocks@RiscPC.enterprise.net> <3C4D9B03.60803@mail.com> <3C4DE2F3.9020904@mail.com> <3C4DF550.24D3333A@nyc.rr.com> <3C4F272B.6020209@mail.com> <3C4EA9BB.B9AB65AE@nyc.rr.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Date: Thu, 24 Jan 2002 08:14:38 GMT NNTP-Posting-Host: 162.83.248.127 X-Complaints-To: business-support@verizon.com X-Trace: nwrddc01.gnilink.net 1011860078 162.83.248.127 (Thu, 24 Jan 2002 03:14:38 EST) NNTP-Posting-Date: Thu, 24 Jan 2002 03:14:38 EST Xref: archiver1.google.com comp.lang.lisp:25129 comp.lang.ada:19270 comp.lang.eiffel:5516 comp.lang.smalltalk:18564 Date: 2002-01-24T08:14:38+00:00 List-Id: Kenny Tilton wrote: > Perhaps I misunderstood. The problem of /copying/ a structure is > clear--how deep is something only the application can decide. Fine. Now > what is all this about assignment having to worry about copying? It was in the problem spec. Anyway, the (now) canonical way to do this ib C++, thanks to Herb Sutter's "Exceptional C++", is to make objects have a non-throwing swap() method, and base assignment on copying: struct s { void swap(s &other) throw(); // non-throwing swap s(const s &other); // copy constructor s &operator=(const s &other) { s(other).swap(*this); return *this; } }; > The story I saw seemed to think you needed both a copy and assignment > method in C++, and that the assignment method also had to worry about > what to copy (and blowing up during a copy). Assignment exists in C++ not least because it exists in C. Like Ada, the default is to do a memberwise copy. If you choose to allow assignment in your class, you have to get it right. > Why confuse the two? I just pass pointers (if you will) around. > assignment is always by reference. Automatic GC gets to clean up after > me. Life is good. When I /copy/ a structure...well, I'll have to get > back to you if it ever comes up.