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: 103376,2e6723b897ab47fb X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Received: by 10.180.75.8 with SMTP id y8mr55927wiv.4.1344414886906; Wed, 08 Aug 2012 01:34:46 -0700 (PDT) Path: n2ni23664042win.0!nntp.google.com!volia.net!news2.volia.net!feed-A.news.volia.net!news.ecp.fr!aioe.org!.POSTED!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: Ada.Locales pseudo-string types Date: Wed, 8 Aug 2012 10:35:01 +0200 Organization: cbb software GmbH Message-ID: <19aidilocj3ue$.ljphjv09js71.dlg@40tude.net> References: <78707b6e-88a3-453a-a37c-840f7a62e703@googlegroups.com> <7303f906-0f6a-4d97-ae15-36b4056ede6c@googlegroups.com> <257b4f44-b6c6-4c79-8c6e-dec947a3ce25@googlegroups.com> 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="us-ascii" Content-Transfer-Encoding: 7bit Date: 2012-08-08T10:35:01+02:00 List-Id: On Wed, 08 Aug 2012 11:17:46 +0300, Niklas Holsti wrote: > For value conversions, including "in" parameters, the exact match could > be replaced by a static check that the constraints on the source > elements are the same as or stronger than those on the target elements. > This would allow Ada.Text_IO.Put (String (Some_Country_Code)). > > For "out" parameters, there could be a static check that the constraints > on the actual (source) array elements are the same as or weaker than > those on the formal (target) array elements. > > For "in out" parameters, the present static-match rule would be kept, as > the logical conjunction of the "in" and "out" rules. 1. You cannot check that statically because the constraint of the subtype can be dynamic. 2. It is extremely uncomfortable to have legality dependant on the constraint and the parameter mode. It is worse than just inference it is in effect weakly typing. I don't want repeating the discussing about dynamic contracts, but this is exactly same issue. You either not allow this, or else you add Constraint_Error to all contracts. There is no sane middle way. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de