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: a07f3367d7,d00514eb0749375b X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!postnews.google.com!26g2000yqv.googlegroups.com!not-for-mail From: Shark8 Newsgroups: comp.lang.ada Subject: Re: initialize an array (1-D) at elaboration using an expression based on the index? Date: Sun, 24 Oct 2010 09:40:14 -0700 (PDT) Organization: http://groups.google.com Message-ID: <9df4e5eb-fba7-4e8c-ba44-cd1ad4081d3b@26g2000yqv.googlegroups.com> References: <1f6bad81-e3d2-428b-a1a0-45acc7f96f68@m7g2000yqm.googlegroups.com> NNTP-Posting-Host: 174.28.203.45 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 X-Trace: posting.google.com 1287938414 21070 127.0.0.1 (24 Oct 2010 16:40:14 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Sun, 24 Oct 2010 16:40:14 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: 26g2000yqv.googlegroups.com; posting-host=174.28.203.45; 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.11) Gecko/20101012 Firefox/3.6.11 ( .NET CLR 3.5.30729; .NET4.0E),gzip(gfe) Xref: g2news1.google.com comp.lang.ada:14718 Date: 2010-10-24T09:40:14-07:00 List-Id: Interesting. It doesn't look like it would be very extensible into multidimensional arrays though. Perhaps something like an 'Initialize attribute [on the type, not the variables thereof] which would take an Access to Function returning that type. It would have to be called only in the case of K : Array_Type because K : Array_Type:= (Others => <>) is providing an initialization of the default value to all the elements [which is unlikely to match the initialization's value]. However, it is the internals of the function which are interesting if this route were taken. The indexings need to be discrete types, however they need not be numeric or even all the same type. This results in the following being valid: Type A_HighSchool_Letterjacket_Type is Array (Size, Color, Character) of Byte; -- A jacket-maker's inventory for letter-jackets. So we can't have an "array" representing the indicies for use in the initialization-function. (ex: ---Invalid For Index_1 in Index(1)'Range loop For Index_2 in Index(2)'Range loop For Index_3 in Index(3)'Range loop -- do stuff for calculating the value stored; end loop; end loop; end loop; )