comp.lang.ada
 help / color / mirror / Atom feed
From: "Jeffrey R. Carter" <spam.jrcarter.not@spam.acm.org>
Subject: Re: Array of Strings
Date: Sun, 28 Sep 2008 19:00:14 GMT
Date: 2008-09-28T19:00:14+00:00	[thread overview]
Message-ID: <2vQDk.363714$yE1.294891@attbi_s21> (raw)
In-Reply-To: <0faf40a8-aac2-42ed-a536-1cc5a9c5d819@8g2000hse.googlegroups.com>

jedivaughn wrote:
> This is going to be a long post but hopefully I'll make myself clearer
> this time. I finally got everything set up in my package and it works
> just fine. however one of the operations that I'm trying to do on the
> package is an append. after appending to the list I want to make sure
> the list is still in order. so I have to make comparisons with the <
> or > operators. however, ada give's me the error: "final.adb:22:34:
> there is no applicable operator ">" for private type "Element_Type"
> defined at final.ads:3."
> 
> Here is my package's .ads file
> 
>     generic
> 
>     type Element_Type is private; -- everything in the list is of this
> type

You should think of the generic formal part (the part between "generic" and 
"package") as a specification: it specifies what the generic needs from its 
clients in order to do what it does.

The various kinds of formal parameters to a generic specify different things. 
For example

type T1 is range <>;

specifies that the generic needs all the features and operations of a signed 
integer type. This includes assignment and conversion from other numeric types.

type T2 is (<>);

specifies that the generic needs a discrete type. This includes integer types 
(signed and unsigned) and enumeration types. The set of features and operations 
used by the generic is naturally different from those for T1.

type T3 is private;

specifies that the generic needs to be able to create objects of the type 
without initialization, or declare composite types with components of the type. 
It specifies that the generic will use assignment of values of the type, and the 
"=" and "/=" operations. That is just about all the generic needs from the type, 
unless it explicitly specifies that it needs additional operations on the type 
in the form of generic formal subprogram parameters operating on the type:

generic
    type T is private;

    with function "-" (Left : in T; Right : in T) return T is <>;
package P is ...

In your case, it sounds as if you need

with function ">" ...

-- 
Jeff Carter
"People called Romanes, they go the house?"
Monty Python's Life of Brian
79



  parent reply	other threads:[~2008-09-28 19:00 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-13 14:18 Array of Strings jedivaughn
2008-09-13 14:32 ` Ludovic Brenta
2008-09-14  0:11 ` anon
2008-09-14  9:45 ` Per Sandberg
2008-09-15 14:54 ` Adam Beneschan
2008-09-16 23:56   ` jedivaughn
2008-09-23 14:07     ` jedivaughn
2008-09-23 14:30       ` mockturtle
2008-09-23 14:41         ` Adam Beneschan
2008-09-23 14:47         ` Ludovic Brenta
2008-09-23 18:51       ` Jeffrey R. Carter
2008-09-24 12:00         ` jedivaughn
2008-09-24 14:36           ` Adam Beneschan
2008-09-24 15:13           ` John McCormick
2008-09-24 17:18           ` Jeffrey R. Carter
2008-09-28 12:24             ` jedivaughn
2008-09-28 13:01               ` mockturtle
2008-09-28 17:08                 ` jedivaughn
2008-09-29 11:14                   ` mockturtle
2008-09-28 19:00               ` Jeffrey R. Carter [this message]
2008-09-29 15:51                 ` Adam Beneschan
replies disabled

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