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,6b6619eb9cada212 X-Google-Attributes: gid103376,public From: Richard D Riehle Subject: RE: Help me to chose between ADA 95 and C++ Date: 1999/12/16 Message-ID: <83b8il$i5k$1@nntp4.atl.mindspring.net>#1/1 X-Deja-AN: 561596455 References: Organization: MindSpring Enterprises X-Server-Date: 16 Dec 1999 17:47:01 GMT Newsgroups: comp.lang.ada Date: 1999-12-16T17:47:01+00:00 List-Id: In article , "Robert C. Leif, Ph.D." wrote: >Richard >I was remarking on a standard private type in the specification of a generic >or any other package. If your numeric types are declared in the private part >of a package, you can not set them equal to the literal value of a number, I am sure Matt Heaney will have some good things to say about this too. The answer is that one must export the methods appropriate to any private type. If that type is a numeric, then methods for all of its uses are necessary. In my published example, I include the operators one would expect. I also include some functions for auxiliary services. Some of these would be, type Number is private; function Set (To : Integer) return Number; function Zero_Equivalent return Number; function Unit_Increment return Number; function Unit_Decrement return Number; In the opinion of many OO practitioners, one should only export services in the public part of a specification. For example, even the popular deferred constant, under this viewpoint, would be better designed as a function returning a constant. That makes it more maintainable and defers information about the constant to the package body. One of the benefits of Ada is its openess to multiple models of object-oriented design. Not every type needs to be value extensible. Ada child packages, and rules of elementary types, provide a model for method extensibility that has far less overhead than might be found in a language where the only mechanism for extensibility is inheritance. Hope this helps, Richard