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,aaabba5db6b5df34 X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news4.google.com!feeder.news-service.com!news2.euro.net!82.197.223.106.MISMATCH!feeder1.cambriumusenet.nl!feed.tweaknews.nl!192.87.166.28.MISMATCH!tudelft.nl!txtfeed1.tudelft.nl!feed.xsnews.nl!border-1.ams.xsnews.nl!151.189.20.20.MISMATCH!newsfeed.arcor.de!newsspool1.arcor-online.net!news.arcor.de.POSTED!not-for-mail From: "Dmitry A. Kazakov" Subject: Re: Min/Max attribute makes promises it can't keep Newsgroups: comp.lang.ada User-Agent: 40tude_Dialog/2.0.15.1 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Reply-To: mailbox@dmitry-kazakov.de Organization: cbb software GmbH References: <98b7e6f2-32ed-465c-9a52-541b7878ca86@y17g2000yqd.googlegroups.com> <9b17e781-f46a-4384-8809-b16602d10114@y30g2000yqh.googlegroups.com> <880dc0f0-7fff-440d-8aad-6ce745fcfed8@h27g2000yqm.googlegroups.com> <246a7cec-bd5f-4c48-a6cb-3874080c19ab@y17g2000yqd.googlegroups.com> <591866ec-fa46-440c-b6fc-3092985ae3df@r27g2000yqn.googlegroups.com> <8ab2d2d1-b7dc-47bf-824f-4cab334a3fd6@11g2000yqr.googlegroups.com> <1pbp1hhh5yb9k.b6b9xs33b4od$.dlg@40tude.net> <4bd841e7$0$7658$9b4e6d93@newsspool1.arcor-online.net> <1t4extnm6iluj.r4x652cntogc$.dlg@40tude.net> <1p28brlj9yc3k$.1nv0ey1aadvoi$.dlg@40tude.net> Date: Sat, 1 May 2010 08:28:10 +0200 Message-ID: NNTP-Posting-Date: 01 May 2010 08:28:11 CEST NNTP-Posting-Host: 91c8f2ab.newsspool3.arcor-online.net X-Trace: DXC=_goQVIh[GEefF8a^:6>b7eMcF=Q^Z^V3h4Fo<]lROoRa8kFT\^nE^;mi[6LHn;2LCVn[ On Sat, 1 May 2010 00:42:53 -0500, Randy Brukardt wrote: > "Dmitry A. Kazakov" wrote in message > news:1p28brlj9yc3k$.1nv0ey1aadvoi$.dlg@40tude.net... >> On Wed, 28 Apr 2010 16:07:24 -0500, Randy Brukardt wrote: >> >>> As for the initial concern about giving a subtype name, in the case of >>> literals you have to give one somewhere (since a literal can be of many >>> different types, and the results can vary depending on the type used -- >>> not >>> for 'Length, but for 'Last and most other properties). >> >> No problem, Ada supports overloading in the result type. E.g. abs (-1) is >> OK. > > That doesn't help. Consider: > > type My_String is array (Natural range <>) of Character; > > Now, if you wrote: > > "ABC"'First > > The answer depends on whether the type of the prefix is String or My_String, > but the type is Integer'Base in both cases. No amount of overloading will > help. How is that different to: package P is function ABC return String; end P; package Q is type My_String is array (Natural range <>) of Character; function ABC return My_String; end Q; use P,Q; ... ABC'First; -- Ambiguous > The language does not want the compiler to have to list out all of the > possible types for a string literal, figure out the appropriate bounds for > all of them, take all of the ones with the appropriate index type, and then > allow the attribute if the answer is the same. That would be silly, of course. But it is not what I meant. Attribute should be an overloaded operation as any other. If the expression happens to be ambiguous there are language means to specify what it is. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de