comp.lang.ada
 help / color / mirror / Atom feed
From: "jimmaureenrogers@worldnet.att.net" <jimmaureenrogers@worldnet.att.net>
Subject: Re: numbers as 'generics' parameters
Date: Fri, 16 May 2008 11:34:53 -0700 (PDT)
Date: 2008-05-16T11:34:53-07:00	[thread overview]
Message-ID: <5a0ab942-667d-4da9-92d6-f1f4d5c82ac8@k10g2000prm.googlegroups.com> (raw)
In-Reply-To: c7b4c3e6-0edd-4bc6-bc7d-cd1d8036b4c8@j33g2000pri.googlegroups.com

Ada does not require the definition of a generic for your example.
Ada provides the ability to define unconstrained array types.

For example, the following package specification defines a vector
type and some operations on that type.

package Vectors is
   subtype Index_Type is Integer range 1..Integer'Last;
   type Vector is array(Index_Type range <>) of Float;
   function "*"(Left : Float; Right : Vector) return Vector;
   function "*"(Left : Vector; Right : Float) return Vector;
   function "*"(Left, Right : Vector) return Vector;
   function "-"(Left : Float; Right : Vector) return Vector;
   function "-"(Left : Vector; Right : Float) return Vector;
   function "-"(Left, Right : Vector) return Vector;
   function "+"(Left : Float; Right : Vector) return Vector;
   function "+"(Left : Vector; Right : Float) return Vector;
   function "+"(Left, Right : Vector) return Vector;
   function "/"(Left : Vector; Right : Float) return Vector;
end Vectors;

Ada provides both compile-time and run-time checks on the
array bounds for type Vector, even though an instance of
Vector can be of any size up to Integer'Last.

Your questions about Ada indicate very little exposure to Ada.
I concur with Adam's recommendation above. Please read up on
Ada. You will find the language to be very usable and very
efficient.

Jim Rogers



  parent reply	other threads:[~2008-05-16 18:34 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-16 17:26 numbers as 'generics' parameters jhc0033
2008-05-16 17:55 ` Adam Beneschan
2008-05-16 19:12   ` John B. Matthews
2008-05-16 18:34 ` jimmaureenrogers [this message]
2008-05-16 18:57 ` Gautier
2008-05-16 20:52   ` Maciej Sobczak
2008-05-16 23:09     ` Peter C. Chapin
2008-05-17  7:47     ` Dmitry A. Kazakov
2008-05-17 16:29       ` Maciej Sobczak
2008-05-17 17:34         ` Dmitry A. Kazakov
2008-05-18 13:58           ` Maciej Sobczak
2008-05-18 14:52             ` Dmitry A. Kazakov
2008-05-18 20:37               ` Maciej Sobczak
2008-05-19  9:02                 ` Dmitry A. Kazakov
2008-05-19  5:16             ` Ivan Levashew
2008-05-19  8:26               ` Maciej Sobczak
2008-05-16 20:22 ` Jeffrey R. Carter
2008-05-21 15:32   ` Robert A Duff
replies disabled

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