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,103b407e8b68350b X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-01-30 06:59:44 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!bloom-beacon.mit.edu!nycmny1-snh1.gtei.net!news.gtei.net!news-out.visi.com!hermes.visi.com!uunet!ash.uu.net!spool0900.news.uu.net!reader0901.news.uu.net!not-for-mail Date: Thu, 30 Jan 2003 09:59:42 -0500 From: Hyman Rosen User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.3b) Gecko/20030116 X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Anybody in US using ADA ? One silly idea.. References: <1043339266.922562@master.nyc.kbcfp.com> <7iLY9.2401$qb1.464@nwrddc01.gnilink.net> <1043680098.61106@master.nyc.kbcfp.com> <3afc3v4uur2kvd53v4ul18b5npjfm188o3@4ax.com> <1043773909.385612@master.nyc.kbcfp.com> <1043855067.848326@master.nyc.kbcfp.com> <3OXZ9.85359$Ve4.6306@sccrnsc03> <1043880843.44251@master.nyc.kbcfp.com> In-Reply-To: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Organization: KBC Financial Products Message-ID: <1043938782.244443@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: 1043938783 reader1.ash.ops.us.uu.net 14056 204.253.250.10 Xref: archiver1.google.com comp.lang.ada:33599 Date: 2003-01-30T09:59:42-05:00 List-Id: Dmitry A. Kazakov wrote: > Now, consider that this additional code not just shifts > a reference, but creates a new object (Ellipse). I suppose a language could define this copy-in/copy-out stuff with conversions. I don't know how useful it would be, but I guess I could be convinced with a compelling example. I would point out that this is completely orthogonal to OO. That is, the only relationship that needs to exist between the two types is for them to be interconvertible. That you want this implies that you are a secret C++ programmer :-) > subtype Non_Negative is Float range 0.0..Float'Last; > > Would you reimplement "-" for Non_Negative just because Non_Negative > is not "isa" Float? I'm a little puzzled. I would try to arrange for "-" NN -> NN to be undefined, and for "-" NN -> Float to have its obvious meaning. I don't know what Ada allows in this case, but that's what I want. > Surely not, you would just catch Constraint_Error as necessary. Surely not, why would I want exceptions raised at run-time for errors that should be prevented at compile-time? > Absolutely. LSP cannot be enforced in all contexts. I don't think you grasped my meaning. I mean that LSP should be decided based on the implemented properties of the programmed objects, not on the abstract or real-world objects that they (partially) model. You can group your properties into subsets, which become interfaces, and then code which operates on these objects can choose to receive the smallest set of interfaces that it needs. I think this is why the C++ template model is so appealing. C++ template functions *automatically* require only the properties they actually use, so you don't need to do an a priori factorization of properties into subsets. I know you object to the fact that the set of used properties is specified only implicitly, and is therefore subject to accidental change, but the positive side is there as well.