* Q:ADA/Java/C++ feature mapping question!? @ 2000-01-20 0:00 alex 2000-01-20 0:00 ` carlislemc ` (4 more replies) 0 siblings, 5 replies; 9+ messages in thread From: alex @ 2000-01-20 0:00 UTC (permalink / raw) Hi, my question should be easy to answer for anyone who knows C++/Java and ADA. Unfortunately I only know C++&Java :-(. Question: What are the corresponding ADA keywords to the given C++/Java features, and which keywords do exist in ADA which have no representation in C++/Java, and what do they mean. I did have a look at the http://www.adahome.com/rm95/ Ada reference Manual, but this would be a longer way to go then I would like to. So could one of you who knows both languages help me out? C++/Java Keywords of interest to me: auto: variable has local (automatic) extent abstract (Java) pure virtual const: functions values are not modifiable explicit: Constructors declared explicit will not be considered for implicit conversions extern: Variable or function has external linkage, or linkage conversion of another language final (Java) class, method cannot be derived from or overwritten friend: function or class has access to private/protected class members interface (Java) concept for abstract interface suitable for multiple inheritance mutable: Non-static non const data members. If declared mutable it is legal to assign a value to this data member from a const member function native (Java) modifier used in the declaration of a method to indicate that the method is implemented in another programming language namespace: obvious package (Java) obvious private: visibility for class member protected: visibility for class member public: visibility for class member register: "asks" compiler to place variable in CPU register synchronized (Java) modifier to specify thread-safe methods static: linkage for variables and functions template: set of parameterized classes or functions virtual: polymorphism for functions, for classes to disable multiple members while using multiple inheritance transient (Java) modifier used in the declaration of variables volatile: type qualifier; object can be modified in the program by something other than statements, such as the operating system, the hardware, or a concurrently executing thread Thank you very much in advance for any help! cu, alex ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Q:ADA/Java/C++ feature mapping question!? 2000-01-20 0:00 Q:ADA/Java/C++ feature mapping question!? alex @ 2000-01-20 0:00 ` carlislemc 2000-01-20 0:00 ` alex 2000-01-20 0:00 ` Tucker Taft ` (3 subsequent siblings) 4 siblings, 1 reply; 9+ messages in thread From: carlislemc @ 2000-01-20 0:00 UTC (permalink / raw) Since OO is done differently in these languages, it would be hard to answer your question by a simple translation table. I'd recommend reading a text that describes the OO features of Ada. For a thorough presentation, see Cohen "Ada as a Second Language". For a high-level overview, try Sebesta "Concepts of Programming Languages" (note this doesn't cover any of the advanced features, just the basics). --Martin In article <8672ec$e28$1@fleetstreet.Austria.EU.net>, "alex" <nulldevice@hotmail.com> wrote: > Hi, > my question should be easy to answer for anyone who knows C++/Java and ADA. > Unfortunately I only know C++&Java :-(. > > Question: What are the corresponding ADA keywords to the given C++/Java > features, and which keywords do exist in ADA which have no representation in > C++/Java, and what do they mean. I did have a look at the Sent via Deja.com http://www.deja.com/ Before you buy. ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Q:ADA/Java/C++ feature mapping question!? 2000-01-20 0:00 ` carlislemc @ 2000-01-20 0:00 ` alex 0 siblings, 0 replies; 9+ messages in thread From: alex @ 2000-01-20 0:00 UTC (permalink / raw) Hi Martin, many thanks for your answer. It is the prove for my preliminary conclusion after continuing to read the Ada Reference Manual. It is somehow possible to map the concepts of ADA and C++, but not the languages "meta model". cu, alex <carlislemc@my-deja.com> wrote in message news:867a85$6m9$1@nnrp1.deja.com... > Since OO is done differently in these languages, it would be hard to > answer your question by a simple translation table. I'd recommend > reading a text that describes the OO features of Ada. For a thorough > presentation, see Cohen "Ada as a Second Language". For a high-level > overview, try Sebesta "Concepts of Programming Languages" (note this > doesn't cover any of the advanced features, just the basics). > > --Martin > > In article <8672ec$e28$1@fleetstreet.Austria.EU.net>, > "alex" <nulldevice@hotmail.com> wrote: > > Hi, > > my question should be easy to answer for anyone who knows C++/Java > and ADA. > > Unfortunately I only know C++&Java :-(. > > > > Question: What are the corresponding ADA keywords to the given > C++/Java > > features, and which keywords do exist in ADA which have no > representation in > > C++/Java, and what do they mean. I did have a look at the > > > Sent via Deja.com http://www.deja.com/ > Before you buy. ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Q:ADA/Java/C++ feature mapping question!? 2000-01-20 0:00 Q:ADA/Java/C++ feature mapping question!? alex 2000-01-20 0:00 ` carlislemc @ 2000-01-20 0:00 ` Tucker Taft 2000-01-20 0:00 ` Brian Rogoff 2000-01-20 0:00 ` Ted Dennison 2000-01-20 0:00 ` Jim Rogers ` (2 subsequent siblings) 4 siblings, 2 replies; 9+ messages in thread From: Tucker Taft @ 2000-01-20 0:00 UTC (permalink / raw) alex wrote: > > Hi, > my question should be easy to answer for anyone who knows C++/Java and ADA. > Unfortunately I only know C++&Java :-(. > > Question: What are the corresponding ADA keywords to the given C++/Java > features, and which keywords do exist in ADA which have no representation in > C++/Java, and what do they mean. I did have a look at the > http://www.adahome.com/rm95/ Ada reference Manual, but this would be a > longer way to go then I would like to. So could one of you who knows both > languages help me out? > > C++/Java Keywords of interest to me: > > auto: variable has local (automatic) extent This is the default in Ada, as it is in C. In fact, in Ada, *all* local variables have "local" extent. It is generally a rule in Ada that the lifetime of an object is determined by where it is declared, not by any keyword like "static" or "own" as in some languages. If you want something to "live" longer, you need to move its declaration out to a scope which lives longer (e.g. an enclosing package). > abstract (Java) pure virtual abstract. > const: functions values are not modifiable "constant" for declared objects, and "in" for parameters > explicit: Constructors declared explicit will not be considered for > implicit conversions Ada has very few implicit conversions, generally only from numeric literals to specific numeric types. There are no implicit conversions based on single-parameter constructors, as in C++. > > extern: Variable or function has external linkage, or linkage conversion > of another language Variables/subprograms declared in the "public" or "visible" part of a package are accessible internally. Note that because of inlines and generics, entities declared in the private part or body of a package may still end up with "extern" linkage, but this is a low-level issue. The equivalent of C++'s 'extern "C" { ... }' are the pragmas Import/Export/Convention (see the section on "interfacing pragmas" in Annex B of the reference manual). > > final (Java) class, method cannot be derived from or overwritten Any operation that is not a "primitive" operation of a type cannot be overridden (nor is it inherited). Any type that is not "tagged" cannot be extended, though you can still "derive" from it without extending. > > friend: function or class has access to private/protected class members Child packages are similar to friends, in that they have additional visibility onto the private declarations of their ancestor packages. > > interface (Java) concept for abstract interface suitable for multiple > inheritance Generic signatures are about the closest thing in Ada 95. A generic signature is a generic package declaration with only a formal part, and no declarations in the visible part. They are useful in combination with formal package parameters. You can also use access discriminants and generic mixins to solve the same kinds of problems solved by multiple inheritance. > > mutable: Non-static non const data members. If declared mutable it is > legal to assign a value to this data member from a const member function A "const" member function is one whose "controlling operand" is of mode "in." There is no notion of a "mutable" component of an "in" object. However, you can accomplish this by using a level of indirection. The component would be accessed via an access-to-variable component. The component itself might be allocated in the heap, or as an "aliased" part of the enclosing record. > > native (Java) modifier used in the declaration of a method to indicate that > the method is implemented in another programming language pragma Import > > namespace: obvious package (roughly -- C++ namespaces don't provide any visibility control) > > package (Java) obvious package (though in Ada, the hierarchical package namespace is relevant to visibility, whereas in Java "sub" packages have no different visibility on their "enclosing" package than any other unrelated package. > > private: visibility for class member declared in package body > > protected: visibility for class member declared in private part of package spec, making it visible to child packages. > > public: visibility for class member Declared in visible part of package spec. > > register: "asks" compiler to place variable in CPU register No particular equivalent. The "inverse" exists, "aliased", which disallows use of a register. > > synchronized (Java) modifier to specify thread-safe methods protected, though it is on a per-type basis, rather than a per-operation basis. > > static: linkage for variables and functions Declare in enclosing package (see above discussion about "auto") > > template: set of parameterized classes or functions generic > > virtual: polymorphism for functions, for classes to disable multiple > members while using multiple inheritance dispatching operation of a tagged type. This is per-type in Ada rather than per-operation. If a type is marked "tagged" then all of its primitive operations are effectively "virtual." If not marked tagged, then none of its primitive operations are virtual. Non-primitive operations are never "virtual." > > transient (Java) modifier used in the declaration of variables No particular equivalent. Would probably be done with a pragma in Ada. > > volatile: type qualifier; object can be modified in the program by > something other than statements, such as the operating system, the hardware, > or a concurrently executing thread pragma Volatile (also see pragma Atomic, which is related). > > Thank you very much in advance for any help! > > cu, > alex -- -Tucker Taft stt@averstar.com http://www.averstar.com/~stt/ Technical Director, Distributed IT Solutions (www.averstar.com/tools) AverStar (formerly Intermetrics, Inc.) Burlington, MA USA ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Q:ADA/Java/C++ feature mapping question!? 2000-01-20 0:00 ` Tucker Taft @ 2000-01-20 0:00 ` Brian Rogoff 2000-01-20 0:00 ` Ted Dennison 1 sibling, 0 replies; 9+ messages in thread From: Brian Rogoff @ 2000-01-20 0:00 UTC (permalink / raw) On Thu, 20 Jan 2000, Tucker Taft wrote: > alex wrote: > > > > Question: What are the corresponding ADA keywords to the given C++/Java > > features, and which keywords do exist in ADA which have no representation in > > C++/Java, and what do they mean. I did have a look at the > > http://www.adahome.com/rm95/ Ada reference Manual, but this would be a > > longer way to go then I would like to. So could one of you who knows both > > languages help me out? > > > > C++/Java Keywords of interest to me: > > > > interface (Java) concept for abstract interface suitable for multiple > > inheritance > > Generic signatures are about the closest thing in Ada 95. A generic > signature is a generic package declaration with only a formal part, > and no declarations in the visible part. They are useful in combination > with formal package parameters. Not really quite the same, since they are really "package interfaces" rather than "type interfaces" as in Java . Its not as easy to combine them as it is to combine Java interfaces either, or more specifically, no equivalent to SML's "include". That said, they are quite useful. You mentioned previously that something like Java interfaces was likely to find its way into the next generation Ada. Are there any pointers to proposals we could look at? -- Brian ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Q:ADA/Java/C++ feature mapping question!? 2000-01-20 0:00 ` Tucker Taft 2000-01-20 0:00 ` Brian Rogoff @ 2000-01-20 0:00 ` Ted Dennison 1 sibling, 0 replies; 9+ messages in thread From: Ted Dennison @ 2000-01-20 0:00 UTC (permalink / raw) In article <38875E47.75A994CA@averstar.com>, Tucker Taft <stt@averstar.com> wrote: > alex wrote: > > register: "asks" compiler to place variable in CPU register > > No particular equivalent. The "inverse" exists, "aliased", which > disallows use of a register. Since C compilers usually ignore "register", you could say that the Ada eqiuvalent is the following comment: -- Please please please compiler, place this object in a -- register. I'll be your best friend... -- T.E.D. http://www.telepath.com/~dennison/Ted/TED.html Sent via Deja.com http://www.deja.com/ Before you buy. ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Q:ADA/Java/C++ feature mapping question!? 2000-01-20 0:00 Q:ADA/Java/C++ feature mapping question!? alex 2000-01-20 0:00 ` carlislemc 2000-01-20 0:00 ` Tucker Taft @ 2000-01-20 0:00 ` Jim Rogers 2000-01-20 0:00 ` Vladimir Olensky 2000-01-21 0:00 ` alex 4 siblings, 0 replies; 9+ messages in thread From: Jim Rogers @ 2000-01-20 0:00 UTC (permalink / raw) In article <8672ec$e28$1@fleetstreet.Austria.EU.net>, "alex" <nulldevice@hotmail.com> wrote: > Hi, > my question should be easy to answer for anyone who knows C++/Java and ADA. > Unfortunately I only know C++&Java :-(. > > Question: What are the corresponding ADA keywords to the given C++/Java > features, and which keywords do exist in ADA which have no representation in > C++/Java, and what do they mean. You can also look into a work produced by Simon Johnston comparing the syntax features of Ada and C++. This work is available in two forms. The more complete form is a book that should be available on Amazon.Com, and an HTML document available from www.adahome.com. The WEB version was written in 1995, so it has not been changed to keep up with changes in the C++ standard. It should be a good starting point to answer your questions. The web page is titled: Ada-95: A guide for C and C++ programmers -- Jim Rogers Colorado Springs, Colorado USA Sent via Deja.com http://www.deja.com/ Before you buy. ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Q:ADA/Java/C++ feature mapping question!? 2000-01-20 0:00 Q:ADA/Java/C++ feature mapping question!? alex ` (2 preceding siblings ...) 2000-01-20 0:00 ` Jim Rogers @ 2000-01-20 0:00 ` Vladimir Olensky 2000-01-21 0:00 ` alex 4 siblings, 0 replies; 9+ messages in thread From: Vladimir Olensky @ 2000-01-20 0:00 UTC (permalink / raw) alex wrote in message <8672ec$e28$1@fleetstreet.Austria.EU.net>... >Hi, >my question should be easy to answer for anyone who knows C++/Java and ADA. >Unfortunately I only know C++&Java :-(. > >Question: What are the corresponding ADA keywords to the given C++/Java >features, and which keywords do exist in ADA which have no representation in >C++/Java, and what do they mean. I did have a look at the >http://www.adahome.com/rm95/ Ada reference Manual, but this would be a >longer way to go then I would like to. So could one of you who knows both >languages help me out? 1. Have a look at "A Comparison of the Object-Oriented Features of Ada 95 and Java" by Benjamin M. Brosgol from Aonix. This paper is located at the http://www.adaic.com/docs/reports/ 2. At http://www.acm.org/sigs/sigada/conf/sa98/papers/ you will find another interesting paper written by the same author : "A Comparison of the Concurrency Features of Ada 95 and Java" . 3. "Ada-95: A guide for C and C++ programmers" at http://www.adahome.com/Ammo/cpp2ada.html also may be useful for you. Hope that in these articles you will find answers to most of your questions. At first two pages there are many very interesting articles and reports as well. Regards, Vladimir Olensky ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Q:ADA/Java/C++ feature mapping question!? 2000-01-20 0:00 Q:ADA/Java/C++ feature mapping question!? alex ` (3 preceding siblings ...) 2000-01-20 0:00 ` Vladimir Olensky @ 2000-01-21 0:00 ` alex 4 siblings, 0 replies; 9+ messages in thread From: alex @ 2000-01-21 0:00 UTC (permalink / raw) Many thanks to all that responded to my question. You have been of great help to me! Very friendly newsgroup! Thanks, alex "alex" <nulldevice@hotmail.com> wrote in message news:8672ec$e28$1@fleetstreet.Austria.EU.net... > Hi, > my question should be easy to answer for anyone who knows C++/Java and ADA. > Unfortunately I only know C++&Java :-(. <SNIP> ^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2000-01-21 0:00 UTC | newest] Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2000-01-20 0:00 Q:ADA/Java/C++ feature mapping question!? alex 2000-01-20 0:00 ` carlislemc 2000-01-20 0:00 ` alex 2000-01-20 0:00 ` Tucker Taft 2000-01-20 0:00 ` Brian Rogoff 2000-01-20 0:00 ` Ted Dennison 2000-01-20 0:00 ` Jim Rogers 2000-01-20 0:00 ` Vladimir Olensky 2000-01-21 0:00 ` alex
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox