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=ham autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,caabf5265fad78e5 X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news3.google.com!feeder1-2.proxad.net!proxad.net!feeder2-2.proxad.net!newsfeed.arcor.de!newsspool4.arcor-online.net!news.arcor.de.POSTED!not-for-mail Date: Mon, 06 Jul 2009 12:53:01 +0200 From: Georg Bauhaus User-Agent: Thunderbird 2.0.0.22 (Macintosh/20090605) MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Learning Ada (Was: unsigned type) References: <59O1m.404661$4m1.69194@bgtnsc05-news.ops.worldnet.att.net> <62792744-daca-437b-bdee-4b8a21f7ce27@j32g2000yqh.googlegroups.com> <82oq45tj2uu26u6ecsgq70bsjskr9dvghr@4ax.com> <878wj61bpo.fsf_-_@nbi.dk> <4a4f6cce$0$31869$9b4e6d93@newsspool3.arcor-online.net> <4Aa4m.421894$4m1.207252@bgtnsc05-news.ops.worldnet.att.net> In-Reply-To: <4Aa4m.421894$4m1.207252@bgtnsc05-news.ops.worldnet.att.net> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Message-ID: <4a51d78d$0$30227$9b4e6d93@newsspool1.arcor-online.net> Organization: Arcor NNTP-Posting-Date: 06 Jul 2009 12:53:02 CEST NNTP-Posting-Host: 0d233feb.newsspool1.arcor-online.net X-Trace: DXC=::B0:CXdU anon schrieb: > Wrong! > I was not talking about the Ada Statements "Type" or "Subtype" but > true Standards that go beyond Ada. "Beyond Ada" sounds like wavy escape rhetorics: Since the inception of what is now Ada, it was pronouncedly clear that Ada is adressing real computer systems and their hardware properties and Ada was and is expressly connected to other standards. Both, real computer systems and other standards do *not* *at* *all* suggest the use of predefined named types from package Standard for all your integer needs, since Ada is smarter than that---unless teachers prohibit the use of its extraordinary base type system! See http://www.stsc.hill.af.mil/crosstalk/2000/08/mccormick.html for the huge value attributable to a decent base type system: "It was the accurate modeling of scalar quantities that contributed the most to Ada's success in this course. This is consistent with studies done on the nature of wicked bugs in software [5] where nearly 80 percent of programming errors in the C/C++ programs studied were a result of problems with scalars. "[5] Eisenstadt, M. (1997). My Hairiest Bug War Stories. Communications of the ACM, 40, 30-37." where "modeling of scalar quantities" is "Modeling of scalar objects. -- Strong typing. -- Range constraints. -- Enumeration types." Aou suggest we should instead use implementation defined types of unknown sizes? > But Ada also, use standards for it types, "Integer", and "Float', with > their associate subtypes. One reason but not the only reason for the range of > these built-in types are the hardware. Each user defined integer type, including operations and objects, is translated giving proper attention to hardware, > First, if this could happen the RM would need a MAJOR overhaul. > It would be easier to create a new language. Because both types are used > throughout the RM defined packages. As has been said, use types from the Standard package if and only if using the standard library. Use package Interfaces.* if and only if interfacing to language external facilities. > Second, the predefined types allow for the program to be more portable, > because a users type might not be accepted on the new system. Portability through *avoiding* type definitions seems a simplicissimus' argument, pardon me. Worse, it's a lure, see Randy Brukardt's report. The statement S : String (Positive'First .. Positive'Last / 2); is largely unpredictable as regards portability from one machine/RTS to another. So where is your portability? If Positive happens to be a type for adressing 2**15 - 1 components, your program might run fine in one environment. Once you port it to GNAT, say, you might be experiencing all kinds of trouble! If you really want programmers to (a) use machine properties, or (b) express maximally extensive types, for example, then make them say so! Ada has the necessary bounds defined for this kind of type definitions: type My_Portability_Type is range 0 .. Integer'Min(System.Max_Int, System.Memory_Size); -- use whatever range is possible This *cannot* be achieved by relying on Standard.Integer. But using the > standards or creating a subtype from the standards is better. An example is: > > type Integer is range -2 ** 256 .. +2 ** ( 256 - 1 ) ; > > which is a valid Ada statement but in a 32-bit and most 64-bit system this > type is not allowed. You would need to use a special array or record type that > is based on the universal-integer or CPU and define the operations in a math > package or packages. There are a few special scientific projects that could > use that type of maybe even a larger type like 1024-bit, but there's not > enough applications for most to spend their time in creating such a package. > Normally, its the scientist that ask for help that developes such packages for > his project and only for his project and then sets the big price tag for others > that package. > > Then third, is without standards types like "Integer" and "Float" how > would the system work. Using Ada, define a "=" or "*" without using the > universal-integer and universal-real types or there operations. No one *ever* said something about removing the predefined anonymous types universal_integer and universal_real *needed* for defining integer types! This and other claims have been adressed; have the postings slipped your attention by any chance?