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: 103376,640b65cbfbab7216 X-Google-Attributes: gid103376,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!postnews.google.com!s19g2000prg.googlegroups.com!not-for-mail From: Graham Newsgroups: comp.lang.ada Subject: Re: Untyped Ada? Date: Fri, 4 Apr 2008 12:14:38 -0700 (PDT) Organization: http://groups.google.com Message-ID: <28302e25-844c-41e1-87f1-b4a86146f330@s19g2000prg.googlegroups.com> References: <47F26C46.3010607@obry.net> <44d88b93-6a90-4c18-8785-2164934ba700@a9g2000prl.googlegroups.com> NNTP-Posting-Host: 86.130.77.75 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Trace: posting.google.com 1207336478 29524 127.0.0.1 (4 Apr 2008 19:14:38 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Fri, 4 Apr 2008 19:14:38 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: s19g2000prg.googlegroups.com; posting-host=86.130.77.75; posting-account=04rmagoAAABZ9PN7u3MdbKIs6DPG57E- User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.13) Gecko/20061201 Firefox/2.0.0.13 (Ubuntu-feisty),gzip(gfe),gzip(gfe) Xref: g2news1.google.com comp.lang.ada:20818 Date: 2008-04-04T12:14:38-07:00 List-Id: On Apr 4, 6:38 pm, "Dmitry A. Kazakov" wrote: > On Fri, 4 Apr 2008 08:16:04 -0700 (PDT), Graham wrote: > > I haven't been using Ada for all that long, but I have been thinking > > that a kinder, gentler version would be nice in some circumstances. > > Not necessarily *no* type-checking, but the ability to mix, say, > > integers, fixed-point types and floats in an equation without > > cluttering up the code with conversions. > > But you can do that. Provided you knew the semantics of Integer + Float > your hands are free. Define > > function "+" (Left : Integer; Right : Float) return Float; > > Here you are. > The 'Ada way' is to define lots of types, right? So you could end up having to maintain hundreds of these functions, couldn't you? Do people do that? Just curious. > The compiler does not define it for you for just one reason. The semantics > of this operation cannot be universally defined. Integers and Floats have > contradicting algebraic properties. + is exact for the former and inexact > for the latter. Therefore if adding them makes sense, that is specific for > the application which gives an interpretation to Integer and Float in some > way. In other words it is your business. > That's the kind of almost philosophical argument I find baffling. People write programs every day that mix integers and floats in calculations, without any special handling, and the results usually make sense. > > I dare say that you wouldn't want to program a missile in such a loose > > way, but for the kinds of things I'm involved in - financial apps and > > simulations - the level of strictness of Ada would be a turn-off for > > many developers. > > This puzzles me. Do not financial applications have quite strict > requirements imposed numeric behavior? Or are you writing for Bear Stearns? > (:-)) > Above all, they have requirements for clarity. Suppose I have something like: tax : Money; -- some kind of fixed-point or decimal tax_rate : Rate; -- some kind of float quantity : Integer; -- or some such I want to be able to write: tax = tax_rate * price * quantity; Because that way everyone can concentrate on the logic of what's going on, rather the mechanics of it. If instead I have to write: tax = Money(tax_rate * Rate( price ) * Rate( quantity )); then that's much harder to follow. I'm open to writing functions like the suggested one: function "*" (X : Feet; Y : Pounds) returns Foot_Pounds; I like that idea. But I'd want persuading that it's a practical idea for a moderately large project. > > Sorting out string handling out would be nice, too. > > What do you mean? In fact Ada's fixed strings handling is the best I know. > You should never need Unbounded_String except for rare cases, when you > wanted to return two strings out of one function. > I don't understand that at all. For any web based application (at least) you need unicode and you can't rely on strings being any particular length. Graham