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: 103376,d2f0af5e440b367f X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-06-27 07:21:21 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!nntp4.savvis.net!uunet!dfw.uu.net!sac.uu.net!ash.uu.net!spool.news.uu.net!not-for-mail Date: Fri, 27 Jun 2003 10:21:00 -0400 From: Hyman Rosen User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.5a) Gecko/20030611 Thunderbird/0.1a X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: proposal for new assignment operators References: In-Reply-To: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Organization: KBC Financial Products Message-ID: <1056723660.713599@master.nyc.kbcfp.com> Cache-Post-Path: master.nyc.kbcfp.com!unknown@nightcrawler.nyc.kbcfp.com X-Cache: nntpcache 3.0.1 (see http://www.nntpcache.org/) NNTP-Posting-Host: 204.253.250.10 X-Trace: 1056723660 29284 204.253.250.10 Xref: archiver1.google.com comp.lang.ada:39814 Date: 2003-06-27T10:21:00-04:00 List-Id: Dmitry A. Kazakov wrote: > What happens [with assignments] if you derive from Matrix? Generally speaking, assignment should only be meaningful between things of the same type. Polymorphic hierarchies should most likely disallow assignment altogether. If the Matrix subclasses are used for things like optimizing storage (eg., diagonal matrices), then assignment remains meaningful, and the semantics is just to assign each matrix element from the source to the target. Remembering previous posts, I suppose I should add the caveat that this refers to derivation as normally used, not derivation as you would like to have it. In C++, we would most likely implement storage variations using templates, not inheritance. > What happens if you aggregate Matrix in some other type? When you write assignment for that type, you decide how to assign the aggregated pieces. In C++, you get a default assignment operator if you don't declare your own, and that does memberwise assignment, so the Matrix component would be assigned using its own assignment operator.