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,c7ea1cb7a2beb2ee,start X-Google-Attributes: gid103376,public From: "Samuel T. Harris" Subject: Re: Disallowing Pre-Defined Operations Date: 2000/03/09 Message-ID: <38C851B6.4AB3878E@Raytheon.com>#1/1 X-Deja-AN: 595425410 Content-Transfer-Encoding: 7bit References: <8a9eeg$qtv$1@newpoisson.nosc.mil> X-Accept-Language: en Content-Type: text/plain; charset=us-ascii Organization: Raytheon Aerospace Engineering Services Mime-Version: 1.0 Newsgroups: comp.lang.ada Date: 2000-03-09T00:00:00+00:00 List-Id: "Charles H. Sampson" wrote: > > During the deliberations that led to Ada 95, was a mechanism for > disallowing the pre-defined operations of a type considered? By "disal- > lowing" I mean some way of informing the compiler that an attempt to use > a certain pre-defined operation is a compile-time error. Did anyone > even ask for it? (Obviously I didn't, even though I've thought since > the mid-eighties that it would be a useful capability to have.) > One could use a derived type and overload the undesired operators to simply raise some appropriate exception. Perhaps Operation_Error. That will give you runtime checks on "improper" usage. As to compile time checks, one can develop an ASIS program which hunts for the offending operators. You can even create you own pragma to denote which operators are not to be referenced. Other compilers may complain about an unsupported or unrecognized pragma, but they should allow compilation. The ASIS program can recognize such pragmas and use them to key in on which operators should not be used. -- Samuel T. Harris, Principal Engineer Raytheon, Aerospace Engineering Services "If you can make it, We can fake it!"