comp.lang.ada
 help / color / mirror / Atom feed
From: Adam Beneschan <adam@irvine.com>
Subject: Re: Array of Strings
Date: Mon, 29 Sep 2008 08:51:12 -0700 (PDT)
Date: 2008-09-29T08:51:12-07:00	[thread overview]
Message-ID: <b1da8b1c-3292-4d13-923d-a22fdc6a9afc@40g2000prx.googlegroups.com> (raw)
In-Reply-To: 2vQDk.363714$yE1.294891@attbi_s21

On Sep 28, 12:00 pm, "Jeffrey R. Carter"
<spam.jrcarter....@spam.acm.org> wrote:

> In your case, it sounds as if you need
>
> with function ">" ...

One other thing: It looks like, in the body of your generic, you're
using both < and >.  (I assume you did get errors about both operators
and just didn't mention it in your post?)  You will need to say either

   with function ">" (Left, Right...

or

   with function "<" (Left, Right...

in the generic formal part as the Mock Turtle and the Mad Ha.... um, I
mean Jeff have pointed out.  But please note that defining one won't
automatically give you the other (there is no rule in the language
that says B<A is the same as A>B for all types, although it's true for
predefined types and one-dimensional arrays of predefined types).  So
you will either need to fix the body so it consistently uses either <
or >, but not both; or you'll need to include "with function" clauses
for *both* operators.  My own preference would be for the first
option; if you're instantiating with a string type or other predefined
types, it doesn't matter that much since the compiler will
automatically define both for you anyway; but if you're going to use
some user-defined record type where the user will need to write their
own "<" or less-than operator, having two "with function" clauses
would force them to write subroutines for both operators, which
shouldn't be necessary IMHO.

                              -- Adam



      reply	other threads:[~2008-09-29 15:51 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
2008-09-29 15:51                 ` Adam Beneschan [this message]
replies disabled

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