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.8 required=5.0 tests=BAYES_00,INVALID_DATE autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,502eafcf316bcb10 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 1994-12-17 15:15:55 PST Path: bga.com!news.sprintlink.net!howland.reston.ans.net!swiss.ans.net!cmcl2!thecourier.cims.nyu.edu!thecourier.cims.nyu.edu!nobody From: dewar@cs.nyu.edu (Robert Dewar) Newsgroups: comp.lang.ada Subject: Re: Ada can't initialize (aggregate) array of length 1? Date: 17 Dec 1994 12:52:01 -0500 Organization: Courant Institute of Mathematical Sciences Message-ID: <3cv8g1$nr3@gnat.cs.nyu.edu> References: <1994Dec12.081230.24978@roxi.rz.fht-mannheim.de> <3clobf$r0p@gnat.cs.nyu.edu> NNTP-Posting-Host: gnat.cs.nyu.edu Date: 1994-12-17T12:52:01-05:00 List-Id: Scott is surprised that GNAT can give a clear error message for the case of an invalid attempt to use a one-element positional aggregate. Indeed this error message can't possibly be given in all situations (because otherwise the language could allow it!) Basically the cases that GNAT cannot correct are cases where you write valid Ada 95 code that simply isn't quite what you meant: procedure x (a : integer); procedure x (a : array_of_integer); now you write x ((1)); thinking that you are calling the second version with an aggregate, when in fact you have written a valid call to the first version. However, if there is an error, GNAT does the following: if I expect type vector of clunk and I actually have something of type clunk and the expression in question is parenthesized then output the appropriate error message complaining about misuse of 1-element positional aggregates. of course no error message can always be "right". When a compiler detects an error, it is in the business of producing the best guess as to what was intended. The above check is just one of many heuristics in the GNAT error detection intended to give more accurate messages. By the way, whenever you get an error message you don't like from GNAT, send a note to gnat-report. It is impossible to always give good error messages, but often such suggestions are useful in tuning up the error messages.