comp.lang.ada
 help / color / mirror / Atom feed
From: Jeffrey Carter <spam.jrcarter.not@spam.not.acm.org>
Subject: Re: need help learning Ada for a modula-2 programmer
Date: Mon, 27 Jan 2014 18:52:55 -0700
Date: 2014-01-27T18:52:55-07:00	[thread overview]
Message-ID: <lc72ho$oc9$1@dont-email.me> (raw)
In-Reply-To: <l90ee99ngsun16ec498p60nm3s0ah29r47@4ax.com>

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


  parent reply	other threads:[~2014-01-28  1:52 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-28  1:06 need help learning Ada for a modula-2 programmer agent
2014-01-28  1:33 ` adambeneschan
2014-01-28  1:52 ` Jeffrey Carter [this message]
2014-01-28 12:18 ` Brian Drummond
2014-02-02  2:47   ` agent
2014-02-02  6:09     ` Jeffrey Carter
2014-02-02 15:02       ` agent
2014-02-02 16:00         ` gautier_niouzes
2014-02-02 19:48         ` Jeffrey Carter
2014-02-03  8:24           ` Dmitry A. Kazakov
2014-02-02 17:18     ` Brian Drummond
2014-02-03  0:10       ` agent
2014-02-03  0:36         ` agent
2014-02-03 12:53         ` Brian Drummond
2014-01-28 22:51 ` Jerry
2014-01-29 12:15   ` Mike H
2014-01-29 20:41     ` Jacob Sparre Andersen
2014-01-29 23:52       ` Jeffrey Carter
2014-01-30  9:05         ` Jacob Sparre Andersen
2014-01-30 14:20       ` Mike H
2014-01-30 14:35         ` Bill Findlay
2014-01-30 15:40           ` Mike H
2014-01-30 23:39         ` Jeffrey Carter
2014-01-31 20:16           ` Mike H
2014-01-29 23:52     ` Jeffrey Carter
2014-01-30  1:44       ` Bill Findlay
2014-01-30  2:01         ` Jeffrey Carter
2014-01-30 12:24       ` Simon Wright
2014-01-30 23:38         ` Jeffrey Carter
2014-02-03 23:12     ` agent
2014-02-04  6:10       ` J-P. Rosen
2014-02-04 22:38   ` agent
2014-01-29 16:58 ` Dirk Heinrichs
2014-01-29 20:43   ` Randy Brukardt
2014-01-29 22:53     ` Georg Bauhaus
2014-01-30 12:13       ` Simon Wright
2014-01-30 17:05     ` Dirk Heinrichs
2014-01-30 23:21       ` Randy Brukardt
2014-01-30  4:29   ` Nasser M. Abbasi
2014-01-30  8:45     ` Where to put change descriptions (Was: need help learning Ada for a modula-2 programmer) Jacob Sparre Andersen
2014-01-30  9:53     ` need help learning Ada for a modula-2 programmer Georg Bauhaus
2014-01-30 21:58       ` Randy Brukardt
2014-01-30 16:28     ` Pascal Obry
2014-01-30 17:43       ` Marius Amado-Alves
2014-01-30 18:10       ` Simon Wright
2014-01-30 22:38       ` Randy Brukardt
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox