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,3ef3e78eacf6f938 X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII Path: g2news2.google.com!news2.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!t-online.de!newsfeed-0.progon.net!progon.net!feeder2.cambriumusenet.nl!feed.tweaknews.nl!193.141.40.65.MISMATCH!npeer.de.kpn-eurorings.net!npeer-ng0.de.kpn-eurorings.net!newsfeed.arcor.de!newsspool4.arcor-online.net!news.arcor.de.POSTED!not-for-mail Date: Tue, 21 Jul 2009 11:31:03 +0200 From: Georg Bauhaus User-Agent: Thunderbird 2.0.0.22 (Macintosh/20090605) MIME-Version: 1.0 Newsgroups: comp.lang.eiffel,comp.lang.ada Subject: Re: Alternatives to C: ObjectPascal, Eiffel, Ada or Modula-3? References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit Message-ID: <4a658ad8$0$30226$9b4e6d93@newsspool1.arcor-online.net> Organization: Arcor NNTP-Posting-Date: 21 Jul 2009 11:31:04 CEST NNTP-Posting-Host: f164a5c0.newsspool1.arcor-online.net X-Trace: DXC=UgFTfAZFBn5LNKYb?b>076ic==]BZ:af>4Fo<]lROoR1^YC2XCjHcb9\cIhE]BZjM2;9OJDO8_SK6NSZ1n^B98i:S\b:mWQV?_2 X-Complaints-To: usenet-abuse@arcor.de Xref: g2news2.google.com comp.lang.eiffel:349 comp.lang.ada:7205 Date: 2009-07-21T11:31:04+02:00 List-Id: Jean-Pierre Rosen schrieb: > Cesar Rabak a �crit : >> Ludovic Brenta escreveu: >>> You focused too much, IMHO, on the range restriction which is not the >>> important part. The important part is that, in Ada, this declares a >>> new *type* (not a "subtype" or "nickname for Float"), which is >>> *incompatible* with Float or any other type. >> More or less. It has all the operations of the derived type, uses the >> same representation on the machine. The incompatibility is syntactic no >> in its essence. >> > Here is the crux of the misunderstanding: sure, at /machine/ level they > are the same, but in the /problem domain/ they are different. The big > difference between Ada an other languages is that types (even elementary > ones) reflect the problem domain, not machine types. It might be worth mentioning that derived elementary types neet *not* have the same representation. Gems #27 and #28 talk about opportunities and dangers of using two different representations for the "same" derived type (as I am certain you know): http://www.adacore.com/category/developers-center/gems/ For example, the multiplications in a silly dummy below use operands of different sizes, as expected. So they are really different, even at the machine level. procedure Rep is package P is type T0 is range 0 .. 1_000; for T0'Size use 16; function From_String(Input: String) return T0; type T1 is new T0; for T1'Size use 64; end P; package body P is separate; use P; X0: T0; X1: T1; Y: T0; begin X0 := P.From_String("3"); X1 := P.From_String("5"); X0 := X0 * X0; X1 := X1 * X1; Y := X0 + T0(X1); pragma Inspection_Point(Y); -- stop ambitious optimizers end Rep; -- Georg Bauhaus