From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!feeder.eternal-september.org!gandalf.srv.welterde.de!news.jacob-sparre.dk!franka.jacob-sparre.dk!pnx.dk!.POSTED.rrsoftware.com!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: how to force the Small aspect of a new type derived from the generic formal type ? Date: Thu, 25 Jan 2018 22:38:05 -0600 Organization: JSA Research & Innovation Message-ID: References: <1aaa851e-495a-4dd4-8db7-0fd84ee8225f@googlegroups.com> Injection-Date: Fri, 26 Jan 2018 04:38:06 -0000 (UTC) Injection-Info: franka.jacob-sparre.dk; posting-host="rrsoftware.com:24.196.82.226"; logging-data="10593"; mail-complaints-to="news@jacob-sparre.dk" X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5931 X-RFC2646: Format=Flowed; Original X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.7246 Xref: reader02.eternal-september.org comp.lang.ada:50156 Date: 2018-01-25T22:38:05-06:00 List-Id: "Mehdi Saada" <00120260a@gmail.com> wrote in message news:cb2eaa5d-f40d-4c35-8df4-b1e04d8d5a4b@googlegroups.com... >> Either the teacher is asking for the impossible > > Actually the teacher isn't asking to do that: he asked at some point to > make it generic, at and at another, to force the Small. I assumed we could > do both. You have to force the Small outside of the generic (on the actual type that is used to instantiate). >>> you can't use most representation aspects on a type derived from a >>> generic formal type. > > I understand. But with this statement: > type Modele is delta <> with SMALL => MODELE'DELTA; > I intend to pass a contract, so that only types whose Small is set the > same as the > Delta will be accepted as valid parameters. I SUPPOSED it works like > this... I > suppose now I was wrong ? Most aspects can't be used on formal type because they would create an implicit contract that would require lots of rules to define. You in fact are trying to do exactly what we thought wasn't important enough to support. In this case, you probably should just use an Assertion to make the check, that's not quite as good because it isn't a compile-time error (although you might get a warning from some compilers). Randy.