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 X-Google-Thread: a07f3367d7,73cb216d191f0fef X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII X-Received: by 10.224.110.68 with SMTP id m4mr6278687qap.2.1364200255166; Mon, 25 Mar 2013 01:30:55 -0700 (PDT) Path: k8ni21259qas.0!nntp.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!goblin1!goblin.stu.neva.ru!feeds.phibee-telecom.net!de-l.enfer-du-nord.net!feeder2.enfer-du-nord.net!gegeweb.org!aioe.org!.POSTED!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: Is this expected behavior or not Date: Mon, 25 Mar 2013 09:32:22 +0100 Organization: cbb software GmbH Message-ID: References: <514874d3$0$6628$9b4e6d93@newsspool2.arcor-online.net> <1o60gooo8xvba$.1ei9cebb07zek$.dlg@40tude.net> <514897bd$0$6641$9b4e6d93@newsspool2.arcor-online.net> <1oqwvcemo8dha$.hevuedtz8eze.dlg@40tude.net> <14aijp8ckzahf$.1ilfm1nw6qgyt$.dlg@40tude.net> <1xg9wka6slgit.1q0leacagdeuv.dlg@40tude.net> <10cliooad0uk.1prxobehp9yr0.dlg@40tude.net> <1upbnm5cl13bs$.pzszb0e3v9zo.dlg@40tude.net> Reply-To: mailbox@dmitry-kazakov.de NNTP-Posting-Host: FbOMkhMtVLVmu7IwBnt1tw.user.speranza.aioe.org Mime-Version: 1.0 X-Complaints-To: abuse@aioe.org User-Agent: 40tude_Dialog/2.0.15.1 X-Notice: Filtered by postfilter v. 0.8.2 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 8bit Date: 2013-03-25T09:32:22+01:00 List-Id: On Sun, 24 Mar 2013 09:27:02 +0100, J-P. Rosen wrote: > Le 24/03/2013 09:17, Dmitry A. Kazakov a �crit : >> Moreover, you want to tell that the behavior of an operation would depend >> on a variable? Do I read it right? Not on the type or value it has. This is >> how you want to deal with simple scalar types? > Yes, the behaviour of assignment depends on the SUBTYPE of the target > variable. Merely in order to warn other readers of c.l.a. It is not a variable property and there exist cases when this matters. E.g. X : Integer := Positive'(-1); This must raise Constrant_Error, though X as an Integer variable does not have any constraint; though Positive allegedly has the value -1. But qualified expression disagrees. Another example where it does matter, that the constraint is not a property of the variable, is the behavior of X'Valid. We can trick the compiler to assign -1 to a Positive through the hole in the semantics of renaming and this will become a "valid" value of: with Ada.Text_IO; use Ada.Text_IO; procedure Test is X : Integer; Y : Positive renames X; begin Y := -1; Put_Line (Boolean'Image (Y'Valid)); end Test; TRUE is printed. [I don't know if Ada 2012 is going to fix this, e.g. considering range a "predicate"] > Now, I think we have reached a point where nothing new can be added, and > we are boring people. Let's agree that we don't agree and stop the thread. Yes. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de