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, MSGID_RANDY autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,46ee7e5bac018343 X-Google-Attributes: gid103376,public From: Jim Rogers Subject: Re: Ada features Date: 2000/01/28 Message-ID: <86t5pq$tb7$1@nnrp1.deja.com>#1/1 X-Deja-AN: 578903940 References: <86sinj$upb$1@netserv.univ-lille1.fr> X-Http-Proxy: 1.1 x23.deja.com:80 (Squid/1.1.22) for client 205.170.64.211 Organization: Deja.com - Before you buy. X-Article-Creation-Date: Fri Jan 28 22:38:50 2000 GMT X-MyDeja-Info: XMYDJUIDada_daddy Newsgroups: comp.lang.ada X-Http-User-Agent: Mozilla/4.0 (compatible; MSIE 5.01; Windows 95; EXCITE) Date: 2000-01-28T00:00:00+00:00 List-Id: In article <86sinj$upb$1@netserv.univ-lille1.fr>, "Bertrand Augereau" wrote: > Hello, > > I would like to know if there are standard solutions for those 2 things in > Ada95 : > > 1) Introspection Not a term used in Ada 95. In standard English this implies some sort of self review or knowledge. What is your meaning here? > > 2) The equivalence of what is done in Java by : > class MVFramework > > class Model extends Object {...} > class View extends Object {...} > } > class MVSpreadsheetFramework extends MVFramework > > class Model {...} // Overrides class MVFramework.Model > class View {...} > } > > .i.e. overriding a nested class Ada 95 implements inheritance through type extension. A component of a tagged type may be another tagged type. Each tagged type must be overridden separately. To achieve the Ada equivalent of overriding a nested class, you need to create a tagged type with elements which are access to class-wide types. There is also no direct Ada equivalent of the Java class Object. type Model is tagged private; ... type Model_Access is access all Model'Class; type View is tagged private; ... type View_Access is access all View'Class; type FrameWork is tagged record This_Model : Model_Access; This_View : View_Access; end record; Types View and Model can be extended indefinitely. Those extensions can still used in type FrameWork. This approach is not without problems. Children of View and Model will possibly have additional subprograms not in View or Model. There is no simple way to access those subprograms without explicitly coding a decision tree based upon the specific tag of each descendant. It is much easier to override behavior only, and not both behavior and state. In Ada behavior is overridden and data (state) is extended through inheritance. Violating that rule makes life difficult. It is often easier to take another look at the problem and redesign the solution to fit the tools, instead of fighting the tools. This advice is good for all languages. -- Jim Rogers Colorado Springs, Colorado USA Sent via Deja.com http://www.deja.com/ Before you buy.