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.2 required=5.0 tests=BAYES_00,INVALID_MSGID, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,f4d5ed8a41b9fc83 X-Google-Attributes: gid103376,public From: Mats Weber Subject: Re: Design of the Ada95 object system Date: 1997/11/28 Message-ID: <347EF0FE.F6B428CD@elca-matrix.ch>#1/1 X-Deja-AN: 293425457 References: <880451634.2136@dejanews.com> Reply-To: Mats.Weber@elca-matrix.ch Organization: ELCA Matrix SA Newsgroups: comp.lang.ada Date: 1997-11-28T00:00:00+00:00 List-Id: Matthew Heaney wrote: > However, the Ada approach is smarter, because you still need a way to > organize types, or otherwise there's a huge proliferation of type names in > global namespace. Precisely the reason Stroustrup added a namespace. But > Ada already has it: the package. Actually, Ada is better still, because > you can organize namespaces in a hierarchy. Smarter ? Well I think that the way operations and types are linked together (i.e. when they appear in the same package spec) is not that smart. There are many problems with that approach, like the freezing rules, unwanted links (e.g. derive Text_IO.Count and you get new versions of New_Line, etc.) and links that are just not there (e.g. an opeation expressed as a generic is never derived/inherited). > >-- An example could look like this: > >tagged package My_Object_Type is > > > > type Some_Type is new Integer range 0..99; You probably don't want to declare types inside package types. > > procedure Some_Proc (I : in out Some_Type); > > XY : Some_Type := 50; > > -- Type/subprogram/variable declarations as usual > > > >end My_Object_Type; > > This is totally not Ada. Just banish this from your mind. If you continue > to think this way you will never be able to immerse yourself into the Ada > way of thinking. In Ada, a module is not a type, and you're not going to > be doing yourself any favors by wishing it were. Have you ever used task types ? They make you think just that way.