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-Thread: 103376,703c4f68db81387d X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news3.google.com!newsfeed2.dallas1.level3.net!news.level3.com!newsfeed-00.mathworks.com!newscon06.news.prodigy.com!prodigy.net!border1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsfeed.arcor.de!news.arcor.de!not-for-mail From: "Dmitry A. Kazakov" Subject: Re: Magic ordering Newsgroups: comp.lang.ada User-Agent: 40tude_Dialog/2.0.14.1 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Reply-To: mailbox@dmitry-kazakov.de Organization: cbb software GmbH References: <4229bad9$0$1019$afc38c87@news.optusnet.com.au> <871xau9nlh.fsf@insalien.org> <3SjWd.103128$Vf.3969241@news000.worldonline.dk> <87r7iu85lf.fsf@insalien.org> <1110052142.832650@athnrd02> <42309456$1@news.broadpark.no> <4232ab3a$0$26547$9b4e6d93@newsread4.arcor-online.net> <1110888090.283361.113590@z14g2000cwz.googlegroups.com> Date: Wed, 16 Mar 2005 21:54:55 +0100 Message-ID: <1vwpx0v7y6mv7$.2jy8becs7g4x.dlg@40tude.net> NNTP-Posting-Date: 16 Mar 2005 21:54:52 MET NNTP-Posting-Host: fd030f60.newsread2.arcor-online.net X-Trace: DXC=_aMg@1]eK:[A?WRXZ37ga[7:ncfD5BXcIX0L9YWa:GfAn; X-Complaints-To: abuse@arcor.de Xref: g2news1.google.com comp.lang.ada:9519 Date: 2005-03-16T21:54:52+01:00 List-Id: On 16 Mar 2005 15:03:51 -0500, Robert A Duff wrote: > "Dmitry A. Kazakov" writes: > >> On Tue, 15 Mar 2005 12:54:30 +0000, Marius Amado Alves wrote: >> >>> (Sorry I changed the subject. I'm just that kind of guy :-) >>> >>> On 15 Mar 2005, at 12:01, Hans Malherbe wrote: >>> >>>> I have to ask myself though: If I am denied access to information that >>>> lets me implement a < operator, am I supposed to be able to sort it? >>> >>> This is one of my favourites. There's always a way. Bit by bit >>> comparison, an arbitrary index, 'Address comparison... >> >> All of which might appear wrong. The objects might be non-contiguous, have >> replicas etc. >> >> Comparison should reflect the semantics of compared things. There is no >> universal way to do it. > > It seems to me that there are two sorts of "<" operator here. > > For one, "<" represents some arbitrary order. It has to have > certain properties, like always returning the same answer on > the same args, and X=Y implies that X X create a container, where you don't care about the order, > just that there is *some* order. > > For the other, "<" represents some semantic property of the type. > Like the usual order of integers, or lexicographic order for > character strings. I see no difference between them. Both have *a* semantics. > It seems to me that the compiler could provide the former, > which allows creating containers, and you can ask Is_Present, > and you can iterate in an arbitrary order. OK. That would mean to have one more class of types. Say, "ordered non-limited". Which differs from usual "is private" that it also has "<", "<=", ">", ">=". And of course "<=", ">", ">=" all are derived from "<", the same way as "!=" is derived from "=". How to ensure transitivity? I don't know. Anyway, we go: type X is ordered [tagged] record ...; type X is ordered array (...) of ...; type X is ordered access ...; ... instead of: type X is [tagged] record ...; type X is array (...) of ...; type X is access ...; The compiler then defines relational operations if user does not do it. It also overrides relation operations by each type extension. I don't think that I'd like this much. I'd prefer a more open mechanism. Because some day, somebody would ask for a group, field, etc. That should not be engraved in the compiler. We had enough problems with limited vs. not classes to add a third one. I believe that better ADTs could do the trick. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de