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,b47b15fda2aeb0b2 X-Google-Attributes: gid103376,public From: jsa@alexandria (Jon S Anthony) Subject: Re: Two ideas for the next Ada Standard Date: 1996/09/03 Message-ID: #1/1 X-Deja-AN: 178241933 sender: news@organon.com (news) references: <50aao3$3r88@news-s01.ny.us.ibm.net> organization: Organon Motives, Inc. newsgroups: comp.lang.ada Date: 1996-09-03T00:00:00+00:00 List-Id: In article <322B5BB0.422E@joy.ericsson.se> Jonas Nygren writes: > Coming from a C/C++ background I have had a hard time to adjust to > many of the Ada features (geez, I have never casted so much before in > my programming life). All in all I have gone native. Ada is my sole By "casting" I presume you really mean conversion. If you find that you are doing this much at all, you are going about things the wrong way. In general, you should have little to no such "casting" going on in Ada. > Still, there are some things I have a problem to adjust to. One is > P(X) instead of the popular X.P notation. I do understand that in Yes, this is something that some people just don't get. I find it much nicer in general than the X.P notation. The latter is inflexible, sometimes clumsy, and gives the mis-impression that X is an active agent (being commanded to do P). > But it is not a question of only these big and 'religious' questions. > E.g. I can not understand why one cannot have an anonymous access > argument which refers to a constant, e.g P(X : access CONSTANT XT). > Why not? What ever could have been said against this? Premature? Maybe because you can? It's trivial? Readily done? First, you are showing your C++ coding mind set here and it is just inappropriate. Typically the correct way of achieving the so called "const" paramenter passing of C++ is to simply use an _in_ mode parameter: procedure P ( X : Xt ); or if you want to be explicit: procedure P ( X : in Xt ); This is basically the correct equivalent to C++ void p (const xt& x) Don't worry about low level fiddling about concerning pass by reference or value. Rest assured that large _in_ mode things will be passed by reference so you don't have to try to hack this as you need to in C++. If for some reason you really do want to have an access to constant, then just write it: type Xt_Const_Ref is access constant Xt; procedure P ( X : Xt_Const_Ref ); I think the problem here is that instead of learning and understanding the Ada model, you are simply trying to write C++ in Ada. A recipe for frustration and annoyance and error if there ever was one. /Jon -- Jon Anthony Organon Motives, Inc. 1 Williston Road, Suite 4 Belmont, MA 02178 617.484.3383 jsa@organon.com