comp.lang.ada
 help / color / mirror / Atom feed
From: Jean-Pierre Rosen <rosen@adalog.fr>
Subject: Re: generics in Ada 83
Date: Wed, 14 Sep 2005 10:14:41 +0200
Date: 2005-09-14T10:14:41+02:00	[thread overview]
Message-ID: <g5m8gd.m29.ln@hunter.axlog.fr> (raw)
In-Reply-To: <pxDVe.3$Fv6.0@dfw-service2.ext.ray.com>

Jeffrey Carter a �crit :
> Defaults are defined for subprograms by inserting "is Name" or "is <>" 
> before the semicolon (;):
> 
>    with procedure Y (Z : in X) is A;
> 
> or
> 
>    with procedure Y (Z : in X) is <>;
> 
> You can't use the former, since it requires a procedure A, visible at 
> the point of the generic, that matches Y. Since you don't know what X is 
> at the point of the generic, you can't have such a procedure.
> 
Let me add something which is maybe not obvious to the OP:
In Ada, the legality of a generic is checked on the generic, not on the 
instantiation. This is a main difference with templates.

The benefit is that if a generic compiles, and the instantiation 
provides parameters that match the contract (of the generic formals), 
then the instantion is *always* OK.

-- 
---------------------------------------------------------
            J-P. Rosen (rosen@adalog.fr)
Visit Adalog's web site at http://www.adalog.fr



  parent reply	other threads:[~2005-09-14  8:14 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-09-13 13:26 generics in Ada 83 REH
2005-09-13 13:30 ` Georg Bauhaus
2005-09-13 16:25   ` REH
2005-09-13 19:23     ` Georg Bauhaus
2005-09-13 13:50 ` Martin Dowie
2005-09-13 16:30   ` REH
2005-09-13 16:41     ` Martin Dowie
2005-09-13 18:43       ` REH
2005-09-13 19:37         ` Ludovic Brenta
2005-09-13 19:53           ` REH
2005-09-13 16:56 ` Jeffrey Carter
2005-09-13 18:53   ` REH
2005-09-13 22:16     ` Jeffrey Carter
2005-09-13 22:44       ` REH
2005-09-14  8:14   ` Jean-Pierre Rosen [this message]
2005-09-14 12:40     ` REH
2005-09-14 13:15     ` Hyman Rosen
2005-09-14 14:08       ` Jean-Pierre Rosen
2005-09-14 15:23         ` Hyman Rosen
2005-09-14 15:41           ` Robert A Duff
2005-09-19 17:58             ` REH
2005-09-20  4:58               ` Hyman Rosen
2005-09-20 12:36                 ` REH
2005-09-20  1:34             ` adaworks
2005-09-20  4:14               ` Jim Rogers
2005-09-21 22:58               ` Robert A Duff
2005-09-22 15:18                 ` adaworks
replies disabled

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