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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,ef86287aa487b07a X-Google-Attributes: gid103376,public From: Matthew Heaney Subject: Re: Pb with use of redefined "=" operator Date: 1998/11/05 Message-ID: #1/1 X-Deja-AN: 408739266 Sender: matt@mheaney.ni.net References: <363F62F3.3FF7@club-internet.fr> <3640B520.D7BEEE72@elca-matrix.ch> <3641D551.CCA4379C@elca-matrix.ch> NNTP-Posting-Date: Thu, 05 Nov 1998 10:27:15 PDT Newsgroups: comp.lang.ada Date: 1998-11-05T00:00:00+00:00 List-Id: Mats Weber writes: > Matthew Heaney wrote: > > > I make it a point that when I create a composite type --an abstract data > > type, or "open," as in your example-- that I guarantee equality will > > compose. > > > > It is for this reason that I always implement (the full view of) ADTs as > > tagged, even if the partial view is not itself tagged. > > But if you do that, then you don't need to explicitly import "=" as a > generic formal, because the reemergence problem does not exist with > (visibly or not) tagged types. But not everyone is enlightened as I am :), and they may "forget" to implement their abstraction as tagged, if they've also overridden predefined equality. My philosophy is, I'll make the generic work, so you the client don't have to think about it. Bullet-proof abstractions. > This also makes the following trick unnecessary: > > > But the solution is trivial: just don't use equality for the composite > > type! What I do is, always declare the equality for composite types as > > abstract: This is not a trick: it's a feature of the language! And besides, this "trick" is only done inside the generic that imports equality for the formal type. Why would anyone complain about using a component that always works? We are not philosophers debating morality -- we are systems builders. Our goal is to build correct systems, by whatever means necessary. If using a language feature to make an abstraction work is "gratuitous," or seems like a "trick," then that is a telling observation of the language itself!