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,db88d0444fafe8eb X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news3.google.com!news.glorb.com!npeer.de.kpn-eurorings.net!newsfeed.arcor.de!news.arcor.de!not-for-mail From: "Dmitry A. Kazakov" Subject: Re: Surprise in array concatenation Newsgroups: comp.lang.ada User-Agent: 40tude_Dialog/2.0.14.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: <1125544603.561847.32140@g47g2000cwa.googlegroups.com> <14muavojz308w.1ouv7xin79rqu$.dlg@40tude.net> <4318486f$0$24154$9b4e6d93@newsread4.arcor-online.net> <43187a50$0$24162$9b4e6d93@newsread4.arcor-online.net> <11p5i525v2q5d$.17ayuwvqhazo1.dlg@40tude.net> <431a00cb$0$2113$9b4e6d93@newsread2.arcor-online.net> <9s72daxfzb4f.1k7noh1qr5qpg.dlg@40tude.net> <431c465d$0$24150$9b4e6d93@newsread4.arcor-online.net> <79fcfodixv3k$.1m7d28joczncs$.dlg@40tude.net> <431c8c35$0$2101$9b4e6d93@newsread2.arcor-online.net> <3ufj318nkubi.a5j4dbvaofhc.dlg@40tude.net> <431d82e3$0$24147$9b4e6d93@newsread4.arcor-online.net> Date: Tue, 6 Sep 2005 15:46:27 +0200 Message-ID: NNTP-Posting-Date: 06 Sep 2005 15:46:28 MEST NNTP-Posting-Host: 9a3ec9ef.newsread2.arcor-online.net X-Trace: DXC=XmjFLRF=8j:E][lTbkER26Q5U85hF6f;4jW\KbG]kaM8Q>n?D9BSA] On Tue, 06 Sep 2005 13:52:53 +0200, Georg Bauhaus wrote: > If the world is logical, as you claim, then our sentences > cannot be illogical, thus our sentences must be proper > propositions, thus decidable. OK, see mathematical type theory (starting for Russel & Whitehead) >> hi and lo are bounds, as such they have definite contracts. They cannot be >> "just" values. Once you formulate the contract, it will be pretty easy to >> show whether it is consistent = no any properly constructed array object >> violates the contract. It is not rocket science, really... > > You have to know the contract of 'First etc. I see they can be surprising, > but I don't see a violation of Ada's well working contracts in > 'First > 'Last. The violation is in inability to construct empty arrays and ranges for some types. >>>Use subtypes. Computers are finite, so are types. >> >> I don't know what a finite type is. You might mean the domain set of a >> type. Then you are wrong, the sets of values of Ada's universal types >> aren't finite. > > Ada's types in a real computer program are finite, no matter what. > Any value in an Ada program is finite due to de facto capacity > constraints. That becomes funny. What is a "finite" value? Is 1/3 finite? What about 0.1? (:-)) >> You can have a type which values comprise an uncountable set >> of any cardinality [I cannot tell for unreachable cardinals, though (:-))] > > I very much doubt that any executable program has ever succeeded in > exstablishing a type representing an uncountable set, other than > symbolically, or by turning it into a countable finite thing, by way > of lazy evaluation. LOL! Any program represents anything symbolically. Do you really believe that 1 is *the* 1? Did you see a label "made in Heaven" on it? (:-)) >> It is not the same as to be able enumerate all these values in one program! > > For any infinite type, > there needs to be an algorithm or a declaration capable of constructing > the values in the type. For infinite types, the algorithms and declarations > don't exist. Surely they do: type Infinite is (Infinity); > Is it so much better to introduce ubiquituous case distinctions > ('Length = 0?) in every (sub)array algorithm just because there happens > to be a mathematical property that may be applied to indexes, forcing > A'First > A'Last to be a bad thing? Yes. There is A'Range, which is legal, consistent and has no overhead of testing if A'First > A'Last. >> Presently the case A'Last < A'First is used to indicate that there >> is no bounds. > > That's wrong, in that it just indicates that A'Last < A'First yields > an empty range. The way how the operation ".." is defined on its operands has nothing to do with existence of bounds of the result. >> It is a quite silly way to handle errors. Instead of an >> immediate response you return nonsensical values > > What nonsensical values are returned in text like "3 .. 1"? Nothing. 3 and 1 are literals. A'First and A'Last aren't. You are mixing expressions and their results. You might claim that it is another unnecessary limitation imposed by mathematics, but it is still so. Of course you could consider the sequence of characters "A'First..A'Last" be equivalent to the sequence "A'Range". But fortunately Ada does not have preprocessor! -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de