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,3ef3e78eacf6f938 X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news1.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!feeder.erje.net!feeder.eternal-september.org!eternal-september.org!not-for-mail From: Colin Paul Gloster Newsgroups: comp.lang.eiffel,comp.lang.ada Subject: Re: Alternatives to C: ObjectPascal, Eiffel, Ada or Modula-3? Date: Tue, 21 Jul 2009 13:38:07 +0000 Organization: A noiseless patient Spider Message-ID: References: Reply-To: Colin Paul Gloster Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Trace: news.eternal-september.org U2FsdGVkX18z7QXt2MMijCJ8Esq0VyMJvRdLKcxHP1M36gf9iYS160Jlukk93CNco7A1mdskByqC+4guhAdVTDrEl97D5HXAJvQ88CVeda5dNcbuzcVBz2qQZjDHm9WuUlNzA/tM3onNXVKGZfQN+0i96WB3zN1tOKhiKdJBo3k= X-Complaints-To: abuse@eternal-september.org NNTP-Posting-Date: Tue, 21 Jul 2009 12:43:58 +0000 (UTC) In-Reply-To: X-Auth-Sender: U2FsdGVkX19EnZuh/FAHp1j2nf31Cm3dVWvXlaoGTwC5Go0dzhc+JgZEouCyXSEKv8lw4Vzk9R8= Cancel-Lock: sha1:rtUvWpz685yx0LRZVjps1oO2OEg= X-X-Sender: Colin_Paul@Bluewhite64.example.net User-Agent: Alpine 2.00 (LNX 1167 2008-08-23) Xref: g2news2.google.com comp.lang.eiffel:355 comp.lang.ada:7224 Date: 2009-07-21T13:38:07+00:00 List-Id: On Mon, 20 Jul 2009, Cesar Rabak wrote: |-------------------------------------------------------------------------------| |"[..] | |Nicholas Paul Collin Gloucester escreveu: | |> On 2009-07-20, Cesar Rabak wrote: | |[..] | |> In this case there is a reason for having more types. An angle and a | |> length are simply not interchangable, so they should not be | |> represented both by Float. The amount of money equal to U.S.$1.00 is | |> not equal to the amount of money equal to 1.00 Canadian dollar, but | |> they are both written with the number 1.00. | |> | | | |I disagree strongly: an angle in radians is a real number as any other there is| |not any intrinsic difference in its *type* on ordinary Mathematics. | |Dimensionally they are 'pure numbers' with no unit atached, your example on | |monetary units being fallacious, so non sequitur." | |-------------------------------------------------------------------------------| I doubt that you or I shall convince me or you but... if you want to complain that I misuse the word "type", then fine. If you want to claim that an angle in radians is the same thing as a length, then you are mistaken. You can measure an angle with a protractor. You can not measure a length with a protractor. You can measure a length with a ruler. You can not measure an angle with a ruler (without some additional hassle). A rotation is not a translation, despite both being transformations. If you believe that a real number of an angle in radians is the same as a length, then do you believe that a real number of an angle gradients is the same as a real number of an angle in degrees? 200.0 (a measurement in gradients of an angle) is not equal to pi (a measurement in radians of the same angle) which is not equal to 180.0 (a measurement in degrees of the same angle). The angle is the same and the numbers are not so casually interchangable. A NASA probe was lost when all units were treated as equivalent numbers. |-------------------------------------------------------------------------------| |"[..] | | | |As for normalization, IMNHO it has to be done in the constructor of the | |class/object, and not as an (external) wrapper." | |-------------------------------------------------------------------------------| I did not necessarily prohibit that. The wrapper could be called by the constructor. The wrapper is external to the floating point Ada type Radians or Magnitude or X_Coordinate or Y_Coordinate, which itself could be restricted to the internals of a client's class, much as a C++ std::string might use a char* internally. If normalization is required, it might not be ideal to keep it in the constructor because a variable could be constructed whose value is changed later, for example --Call a constructor for Radius but do not give it a value yet. [..] for some_iterations loop Radius := Get_Current_Radius; --Do stuff. end loop; |-------------------------------------------------------------------------------| |"> With the type Radians as I had typed it, | |> Theta := 7.0; | |> would not result in a runtime exception. It would be rejected by a | |> compiler. | | | |Because we are dealing with examples with literals, let the value come from an | |input... | | | |[..]" | |-------------------------------------------------------------------------------| Literals are not restricted to input, but yes, a runtime exception would occur with input if some other precaution is not taken.