comp.lang.ada
 help / color / mirror / Atom feed
From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: how to force the Small aspect of a new type derived from the generic formal type ?
Date: Wed, 24 Jan 2018 21:30:55 -0600
Date: 2018-01-24T21:30:55-06:00	[thread overview]
Message-ID: <p4bj1f$s47$1@franka.jacob-sparre.dk> (raw)
In-Reply-To: 1aaa851e-495a-4dd4-8db7-0fd84ee8225f@googlegroups.com

"Mehdi Saada" <00120260a@gmail.com> wrote in message 
news:1aaa851e-495a-4dd4-8db7-0fd84ee8225f@googlegroups.com...
> Yet again... Look at this ! The teacher said: use Small 
> aspect/representation clause, and somewhere else he said to make the 
> package generic. I did both...
>
> generic
>   type Modele is delta <> ;
> package Proba is
>   type T_proba is new MODELE range 0.1..1.0 with Small => Modele'Delta;
>
> gives us: representation item not allowed for generic type

That's just what the error message says; you can't use most representation 
aspects on a type derived from a generic formal type.

Even if you were not in a generic unit, you can't usually put representation 
aspects on a derived type (they usually have to match the original type). 
The representation aspects have to go on the original type (the one passed 
into the generic unit).

...
> How do I do that ? Forcing the representation of a new type derived from 
> the generic formal type ?

You can't do that; the derived type has to have the same representation as 
the formal type.

Either the teacher is asking for the impossible (which, unfortunately IS 
possible), or you misunderstood the request.

                          Randy.



  reply	other threads:[~2018-01-25  3:30 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-24 19:16 how to force the Small aspect of a new type derived from the generic formal type ? Mehdi Saada
2018-01-25  3:30 ` Randy Brukardt [this message]
2018-01-25 12:54   ` Mehdi Saada
2018-01-26  4:38     ` Randy Brukardt
2018-01-26 11:13     ` Alejandro R. Mosteo
2018-01-25 18:35   ` G. B.
2018-01-26  4:42     ` Randy Brukardt
replies disabled

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