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 autolearn=unavailable autolearn_force=no version=3.4.4 Path: border1.nntp.dca3.giganews.com!backlog3.nntp.dca3.giganews.com!border3.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!goblin1!goblin.stu.neva.ru!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Jeffrey Carter Newsgroups: comp.lang.ada Subject: Re: need help learning Ada for a modula-2 programmer Date: Mon, 27 Jan 2014 18:52:55 -0700 Organization: Also freenews.netfront.net; news.tornevall.net Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Tue, 28 Jan 2014 01:52:57 +0000 (UTC) Injection-Info: mx05.eternal-september.org; posting-host="6bab1dce10a849dba13303bd95a0f77d"; logging-data="24969"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/0nzz37fePpoaX9sKWuHEhEaAlBaQkmBY=" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 In-Reply-To: Cancel-Lock: sha1:lTjBp0PydkJJhgE8H72+mS8fZVI= X-Original-Bytes: 2734 Xref: number.nntp.dca.giganews.com comp.lang.ada:184583 Date: 2014-01-27T18:52:55-07:00 List-Id: On 01/27/2014 06:06 PM, agent@drrob1.com wrote: > The following code does not compile. I don't understand why. > > The string processing fails to compile, saying "prefix of image must > be a type" That seems like a pretty straightforward error message. > M0,D0,Y0 : Natural; > ... > Intermedstr := M0'Image & Datesepchar & D0'Image & Datesepchar & > Y0'Image; M0 is not a type, but you are using it as the prefix of 'Image. Since the prefix of 'Image must be a type, as the error message told you, you need to use a type as the prefix of 'Image: Integer'Image (M0) Note that Intermedstr is 10 characters long, and the result of your expression (once you've corrected the use of 'Image) may not be 10 characters long. In that case, you will get Constraint_Error raised by the assignment. > "move is undefined" Again, quite straightforward. You attempt to call Move, but you haven't defined such a procedure, nor have you withed anything that defines it. You may be thinking of Ada.Strings.Fixed.Move, in which case you'd need to with Ada.Strings.Fixed. > I don't yet understand string processing with Ada String processing in Ada is quite simple. Type String is an unconstrained 1-dimensional array type, and is no different from any other unconstrained 1-dimensional array type. As long as you don't think that there's something special about String you shouldn't have any problem. -- Jeff Carter "What I wouldn't give for a large sock with horse manure in it." Annie Hall 42