comp.lang.ada
 help / color / mirror / Atom feed
From: "Yannick Duchêne (Hibou57)" <yannick_duchene@yahoo.fr>
Subject: Re: Design by contract and control inversion
Date: Fri, 02 Nov 2012 13:32:05 +0100
Date: 2012-11-02T13:32:05+01:00	[thread overview]
Message-ID: <op.wm5brrn9ule2fv@cardamome> (raw)
In-Reply-To: op.wm41x3yxule2fv@cardamome

Le Fri, 02 Nov 2012 09:59:53 +0100, Yannick Duchêne (Hibou57)  
<yannick_duchene@yahoo.fr> a écrit:
> […]
>      package ABC.Sets.Base is
>
> […]
>      package ABC.Sets.Functional is
>

Out of the primary topic, but a tiny tip I forgot while posting the  
excerpts (as it may be worth to people discovering Ada).

Replace the beginning of `ABC.Sets.Base`, with the following:


     package ABC.Sets.Base is

        package Formals is
           subtype Element_Type is Base.Element_Type;
           subtype Cardinal_Type is Base.Cardinal_Type;
        end Formals;


Then replace the beginning of `ABC.Sets.Functional` with the following:


     package ABC.Sets.Functional is

        package Formals is
           package Base renames Functional.Base;
        end Formals;


That's a useful tip, which will allow you to access the formal parameters  
of an instance of a generic package, whenever needed. Otherwise, as an  
example, `Base.Cardinal_Type` won't be visible from outside of its  
hierarchy, if ever you needed to refer to it this way. Instead of  
`Base.Cardinal_Type` you will then do `Base.Formals.Cardinal_Type`, and  
will be OK. This question used to be discussed about two years ago on this  
Usenet.


-- 
“Syntactic sugar causes cancer of the semi-colons.” [1]
“Structured Programming supports the law of the excluded muddle.” [1]
[1]: Epigrams on Programming — Alan J. — P. Yale University



  reply	other threads:[~2012-11-08  5:39 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-31 19:28 Design by contract and control inversion Yannick Duchêne (Hibou57)
2012-11-01 17:13 ` Yannick Duchêne (Hibou57)
2012-11-01 20:29 ` Adam Beneschan
2012-11-02  3:40   ` Yannick Duchêne (Hibou57)
2012-11-02  8:59     ` Yannick Duchêne (Hibou57)
2012-11-02 12:32       ` Yannick Duchêne (Hibou57) [this message]
2012-11-07  1:34       ` Yannick Duchêne (Hibou57)
2012-11-02 16:45 ` Shark8
2012-11-07  1:51   ` Yannick Duchêne (Hibou57)
replies disabled

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