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!nntp-feed.chiark.greenend.org.uk!ewrotcd!newsfeed.xs3.de!io.xs3.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: syntaxic exploration Date: Thu, 21 Dec 2017 01:18:37 -0600 Organization: JSA Research & Innovation Message-ID: References: <0d33e631-e63d-4346-ac95-5eec72127f4f@googlegroups.com> Injection-Date: Thu, 21 Dec 2017 07:18:38 -0000 (UTC) Injection-Info: franka.jacob-sparre.dk; posting-host="rrsoftware.com:24.196.82.226"; logging-data="19405"; 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:49565 Date: 2017-12-21T01:18:37-06:00 List-Id: "Mehdi Saada" <00120260a@gmail.com> wrote in message news:0d33e631-e63d-4346-ac95-5eec72127f4f@googlegroups.com... > I'm being modelizing polynomes. I've got those two things: > p_poly_v1_g.adb:51:21: iterable name cannot be a discriminant-dependent > component of a mutable object > Ah ? So I can't write that ? > return RESULTAT : T_POLYNOME := POLY do > for ELEMENT of RESULTAT.COEF loop Correct. You can't write this, because the iterable item could disappear in the body of the loop. (If someone assigned a different value to the mutable variable.) This is the same rule as used for renames (you can't rename this component, either, for the same reason). ... > I've got that too: > p_poly_v1_g.adb:59:86: selector name should be identifier or "others" > > return RES: T_POLYNOME := > (T_DEGRE'MAX(POLY_A.DEGRE,POLY_B.DEGRE),POLY_A.COEF'Range => POLY_A.COEF, > others => Nulle) do > > I thought X'Range was strictly equivalent to X'First..X'Last ? 'Range is rather a wart in the language; it can only be used in a few specific places. That's because X'Range is neither a subtype constraint nor a value, and those are the only things with general rules. However, an aggregate choice is one the places that 'Range can be used, so you're obviously doing something else wrong. (Which I can't see given the partial code here.) Randy.