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,611f4b10cbf9af69 X-Google-Attributes: gid103376,public From: bobduff@world.std.com (Robert A Duff) Subject: Re: Redefinition of Equality (Long) Date: 1996/09/29 Message-ID: #1/1 X-Deja-AN: 186031314 references: <52hgmoINN7tg@snoopy.cis.ohio-state.edu> organization: The World Public Access UNIX, Brookline, MA newsgroups: comp.lang.ada Date: 1996-09-29T00:00:00+00:00 List-Id: In article <52hgmoINN7tg@snoopy.cis.ohio-state.edu>, david scott gibson wrote: >In order to compare the elements from two sets, a redefined equality >function must remove elements from the sets first. ... It seems highly undesirable for "=" to modify its parameters. If you want to implement "=" in terms of some destructive operations, then you ought to make a copyof the parameters first. Why is this a problem? I certainly agree that functions should allow 'in out' parameters, but not so you can write evil "=" operations. But even if 'in out' were allowed, you would still have your problem, because for *tagged* types an overriding operation has to be subtype conformant with what it's overriding. You ask why the rule about 'in out' wasn't changed. I think it was for two reasons: (1) Tucker was ambivalent, and was worried about implementation difficulties (having to do copy-backs for out parameters in the middle of an expression, rather than only at the end of a statement, for an existing compiler that wasn't designed to do that). (2) About half of the reviewers were rabidly anti-side-effect zealots. Despite the fact that Ada functions allow side effects on globals, and on stuff pointed to by parameters, this contingent believed that preventing *some* forms of side effects (namely, on parameters) is better than nothing. I was very much in favor of removing this restricion. And I've found it frustrating when writing Ada 95 code. I happen to think that *some* kinds of side effects are OK, and I find it annoying that I have to use access parameters, and put "aliased" and "'Access" all over the place. - Bob