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.6 required=5.0 tests=BAYES_00,FROM_WORDY autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,fd63afa4dc364b7e X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-03-26 16:30:02 PST Path: supernews.google.com!sn-xit-03!supernews.com!nntp.cs.ubc.ca!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!news.stealth.net!207.115.63.142.MISMATCH!newscon02.news.prodigy.com!newscon06.news.prodigy.com!prodigy.com!newsmst01!postmaster.news.prodigy.com!newssvr16.news.prodigy.com.POSTED!not-for-mail From: "Ken Garlington" Newsgroups: comp.lang.ada References: <98m938$2iod0$1@ID-25716.news.dfncis.de><98pgs1$32up7$1@ID-25716.news.dfncis.de><98umc6$39coj$1@ID-25716.news.dfncis.de> Subject: Re: Static typing (Was Re: Better support for garbage collection) Organization: ex-FlashNet, now Prodigy X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4522.1200 X-Mimeole: Produced By Microsoft MimeOLE V5.50.4522.1200 Message-ID: NNTP-Posting-Host: 65.67.102.68 X-Complaints-To: abuse@prodigy.net X-Trace: newssvr16.news.prodigy.com 985652697 6207069 65.67.102.68 (Mon, 26 Mar 2001 19:24:57 EST) NNTP-Posting-Date: Mon, 26 Mar 2001 19:24:57 EST Date: Tue, 27 Mar 2001 00:24:57 GMT Xref: supernews.google.com comp.lang.ada:6094 Date: 2001-03-27T00:24:57+00:00 List-Id: "Robert A Duff" wrote in message news:wccr8zl4h0n.fsf@world.std.com... : Certainly 1/2 is not a literal. Not in Ada, and not by me. : : >... CW would say that it is a : > division operation involving two integers; why should the result be a : > floating-point number? : : I would say, it's a division operation involving two *literals* : (where literal implies no particular type). : : The interpretation of those literals should be resolved by the context. Note, however, that if these literals were "interpreted" as their "obvious" floating-point context, and the function I posted earlier were introduced, you'd have to decide if now (a) the literals were "more obviously" an integer or (b) that the correct form could not be determined from context. Either way would seem very awkward to me. Granted, you have that problem now distinguishing different decimal representations, but I certainly wouldn't want to make it any worse! : >... If we are to have implicit casts of integers to : > floating point values, why not then permit the more general: : > : > Y : Float := ferble; : > : > where "ferble" is a function that returns an integer (or, for that matter, : > any fixed-point) type? : : Why not? Because it makes no sense. Converting type Standard.Integer : to Standard.Float probably makes no sense. A conversion (or "interpretation", if you prefer) of a representation that is numeric, but has an implied decimal point to the right of the last digit, to a representation that has an explicit decimal point to the right of the last digit, makes no sense? Then why do you want an Ada compiler to do it for literals? : But implicitly converting : "1" to (say) Float *does* make sense. I was only talking about : literals. Again, this makes about as much sense as insisting that 1 be implicitly coverted to character, string... or, for that matter, "one half" to be converted to some numeric type. After all, if you're going to object to the "overhead" of adding .0, then why not object to adding quote marks for a character or a single-word string (in the absence of some object with that name)... isn't each "obvious in context"? : Note that Ada always converts literals to some particular type. Sure... some type that is *closest* to the representation *as entered*. If you don't enter a decimal point, why would you expect it to be converted to a representation that requires a decimal point (fixed or floating)? : Note also that I'm not advocating all manner of implicit conversions. : Certainly no implicit conversions that might lose information. What about a conversion that adds *unintended* information?