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.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,ae138939b724a2de X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,UTF8 Path: g2news2.google.com!news3.google.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Mart van de Wege Newsgroups: comp.lang.ada Subject: Re: Single element arrays as function parameters Date: Fri, 10 Jun 2011 23:28:26 +0200 Message-ID: <86aadpv0jp.fsf@gareth.avalon.lan> References: <86ei31v43e.fsf@gareth.avalon.lan> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: individual.net A0nqkb5k0GZqjEK73mdEHAv7Zfs3aYDcmz0ZCsUQmUSEE4p1rH X-Orig-Path: gareth.avalon.lan!not-for-mail Cancel-Lock: sha1:KJni74j0jkbGkolqfYT6ftJlSes= sha1:byqjdTW09ppe0yO+wexPeEtSstU= User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux) Xref: g2news2.google.com comp.lang.ada:20709 Date: 2011-06-10T23:28:26+02:00 List-Id: "J-P. Rosen" writes: > Le 10/06/2011 22:11, Mart van de Wege a écrit : > >> M := Init.Creature( Name => "Dwarf", >> Creature_Type => Humanoid, >> Creature_Subtype => (Dwarf) ); >> >> The above call fails to compile: >> >> test_create.adb:13:45: positional aggregate cannot have one component > This is the clue: it is interpreted as a parenthesized value, not as an > aggregate. Just write: > > M := Init.Creature( Name => "Dwarf", > Creature_Type => Humanoid, > Creature_Subtype => (1 => Dwarf) ); Brrr. That works, but it looks a bit...ugly. Especially considering that creatures only having one subtype[1] is the norm in Dungeons&Dragons (the application in question is meant to help manage large amounts of data to assist in running a campaign). If there is no more elegant solution, I'll fix this by adding the necessary remarks to the API description, in the unlikely case that someone else except me is ever interested in this application. Mart [1] Side note: automating D&D in Ada is a pain, given the amount of overlap between game terms and Ada keywords: Character, Class, Type, Subtype... -- "We will need a longer wall when the revolution comes." --- AJS, quoting an uncertain source.