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=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 Path: border1.nntp.dca.giganews.com!nntp.giganews.com!newspeer1.nac.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.datemas.de!rt.uk.eu.org!aioe.org!.POSTED!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: Renaming vs assignment to constant Date: Sat, 7 Dec 2013 09:57:27 +0100 Organization: cbb software GmbH Message-ID: References: <361fb7d4-d22e-4ac3-a307-48108c4f8eb0@googlegroups.com> Reply-To: mailbox@dmitry-kazakov.de NNTP-Posting-Host: K+4Sku9d0Ugkd/hEqjWvjA.user.speranza.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@aioe.org User-Agent: 40tude_Dialog/2.0.15.1 X-Notice: Filtered by postfilter v. 0.8.2 Xref: number.nntp.dca.giganews.com comp.lang.ada:184126 Date: 2013-12-07T09:57:27+01:00 List-Id: On Fri, 6 Dec 2013 13:59:21 -0800 (PST), Shark8 wrote: > After using some of the Ada1012 features it'd be kinda nice to put > pre/post conditions on a callback independent of those of the actual > subprogram referenced; perhaps: Renaming was always infamous for ignoring whatever constraints: type A is array (Integer range <>) of Float; procedure Foo (X : in out A) is subtype Slided is A (10..20); Y : Slided renames X (X'First..X'First + 9); begin X (10) := 0.0; -- Not what you would think! end Foo; So it would not work unless renaming fixed first. Neither would happen. Then, the very idea of putting constraints on individual objects is just wrong because untyped and fragile design. Constraint should be a property of a type if a part of the contract. Instances should have no contracts of their own. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de