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: border2.nntp.dca1.giganews.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!usenet.blueworldhosting.com!feeder01.blueworldhosting.com!feeder.erje.net!eu.feeder.erje.net!gandalf.srv.welterde.de!news.jacob-sparre.dk!loke.jacob-sparre.dk!pnx.dk!.POSTED!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: Question regarding example code in AI12-0140 Date: Fri, 7 Nov 2014 21:58:30 -0600 Organization: Jacob Sparre Andersen Research & Innovation Message-ID: References: NNTP-Posting-Host: 24-196-82-226.static.mdsn.wi.charter.com X-Trace: loke.gir.dk 1415419114 14301 24.196.82.226 (8 Nov 2014 03:58:34 GMT) X-Complaints-To: news@jacob-sparre.dk NNTP-Posting-Date: Sat, 8 Nov 2014 03:58:34 +0000 (UTC) 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.6157 Xref: number.nntp.giganews.com comp.lang.ada:190380 Date: 2014-11-07T21:58:30-06:00 List-Id: "AdaMagica" wrote in message news:bc4efa4f-7b39-4ca8-8c3b-503eef0039ea@googlegroups.com... > Am Donnerstag, 30. Oktober 2014 16:59:31 UTC+1 schrieb Mark Lorenzen: >> In AI-0140 the following example code is given: >> >> with Ada.Unchecked_Deallocation; >> >> package UNC is >> >> type My_String (<>) is limited private; >> type My_String_Access is access My_String; >> private >> type My_String is new String; >> procedure Free is new >> Ada.Unchecked_Deallocation (My_String, My_String_Access); >> >> end UNC; >> >> The AI discusses if this is legal Ada or not. > > Hu - I've got severe problems to understand the AI. It says: > "The full view of My_String is constrained, while My_String_Access > designates the partial view of My_String, which is unconstrained." > > But since when is type String constrained? So why is the full view of > My_String constrained? > > Am I blind? I ran out of time to re-check the logic of this one before making it into an AI. So I copied the original discussion directly into the AI, but I agree it makes no sense as written. I'm sure I meant that the *partial view* is constrained. Brad points out that 3.7(26) says that it is unconstrained and indefinite, but this is not intended to be normative wording and only the "indefinite" part is backed up by other wording in the Standard (at least that I can find in a 30 second search of the RM). In any case, the truly operative part is that we're statically matching a type with unknown discriminants to a type with no discriminants (and unconstrained bounds), and nothing in the Standard says that's allowed. ("Nothing" certainly being different than "unknown"). I agree that the wording *should* allow this (the language would not make much sense if two views of the same subtype didn't match), but it doesn't. Thus the AI. (Why Janus/Ada implements this litererally, I don't know, but it's probably related to trying to get some ACATS test with picky rules checks to pass.) Randy.