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.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,e55245590c829bef X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII Path: g2news2.google.com!postnews.google.com!j2g2000yqf.googlegroups.com!not-for-mail From: Shark8 Newsgroups: comp.lang.ada Subject: Re: Beginners question: Compound types, how-to? Date: Mon, 1 Nov 2010 08:04:56 -0700 (PDT) Organization: http://groups.google.com Message-ID: References: <86wroy58ff.fsf@gareth.avalon.lan> <86pqup5xfy.fsf@gareth.avalon.lan> NNTP-Posting-Host: 174.28.254.71 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1288623897 9493 127.0.0.1 (1 Nov 2010 15:04:57 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Mon, 1 Nov 2010 15:04:57 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: j2g2000yqf.googlegroups.com; posting-host=174.28.254.71; posting-account=lJ3JNwoAAAAQfH3VV9vttJLkThaxtTfC User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.2.12) Gecko/20101026 Firefox/3.6.12 ( .NET CLR 3.5.30729; .NET4.0E),gzip(gfe) Xref: g2news2.google.com comp.lang.ada:16073 Date: 2010-11-01T08:04:56-07:00 List-Id: On Nov 1, 1:12=A0am, Mart van de Wege wrote: > Jeffrey Carter writes: > > Thanks to Jeffrey and the others. Yes, this was an elementary mistake, > and I kept overlooking it because I also have C experience, so I kept > reading Character as a perfectly fine identifier and dismissing Char > because I thought it was a reserved word. > > I should have realised sooner that Ada uses full words, not > abbreviations, whenever possible. > > I recompiled with Char as the type name; it looks ugly, but I think I > know a way around that, but that involves inheritance, and I am not > touching that just yet. > > My test code works fine now. I am relieved at least to know that my > logic was sound, even if the code wasn't particularly. > > Mart > -- > "We will need a longer wall when the revolution comes." > =A0 =A0 --- AJS, quoting an uncertain source. You could have appended "_Type" to the type declaration giving "Character_Type." This gives the added advantage of allowing your parameters to be highly descriptive, especially if you use named-association when calling the parameters. Ex: Procedure Do_Damage( Character : In Out Character_Type; Amount : In Positive ); -- the spec for a procedure -- using the procedure declare Dave : Character_Type:=3D Randomize_Stats; -- Initialize a character begin ... -- Dave was hit in a bar-fight for 3 damage Do_Damage( Amount =3D> 3, Character =3D> Dave ); -- Note that with named association you may put the parameters in arbitrary order ... end;