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-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,fd63afa4dc364b7e X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-03-19 20:25:10 PST Path: supernews.google.com!sn-xit-02!supernews.com!news.tele.dk!210.147.7.1!newsfeed.mesh.ad.jp!sjc-peer.news.verio.net!news.verio.net!sea-read.news.verio.net.POSTED!not-for-mail Newsgroups: comp.lang.ada From: Brian Rogoff Subject: Re: Static typing (Was Re: Better support for garbage collection) In-Reply-To: Message-ID: 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> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Date: Tue, 20 Mar 2001 04:21:37 GMT NNTP-Posting-Host: 206.184.139.136 X-Complaints-To: abuse@verio.net X-Trace: sea-read.news.verio.net 985062097 206.184.139.136 (Tue, 20 Mar 2001 04:21:37 GMT) NNTP-Posting-Date: Tue, 20 Mar 2001 04:21:37 GMT Organization: Verio Xref: supernews.google.com comp.lang.ada:5882 Date: 2001-03-20T04:21:37+00:00 List-Id: On Mon, 19 Mar 2001, Robert A Duff wrote: > Brian Rogoff writes: > > I don't understand what you mean. Are you complaining about the fact that > > '0' is an int, for instance? > > Yes. I think there should be many integer types (as in Ada), > so it makes no sense to say that '0' is an 'int' just because it looks > like an int. The type of '0' is determined by context in Ada, > and I like that. Yes, I like that too. MLs kind of suck compared to Ada when it comes to scalars. Of course, since MLs don't have overloading (yes, SML has some fixed overloading but that's worse than no overloading IMO) you can't really expect them to handle scalars as well. Even to get something like a Positives or Naturals you have to roll them yourself using the module system. > One thing I don't like in Ada is that '0' can't be a Float. > After all, when I write the rational number "one half" on > a piece of paper, I can write something like "1/2", and everybody knows > what I mean. I don't write "1.0/2.0" -- the ".0" is superfluous. Hmmm, that one never bothered me, but now that you mention it. > Another thing I don't like is that if I write (for example), an > exact-rational-arithmetic package in Ada, I can't use literals -- > literals are only allowed for the built-in kinds of types. Yes, *that* is a problem. There are quite a few places in Ada where I'd like to make user defined types have capabilities of builtins, but can't. It's also the case that if you wanted to make an STL inspired library have Ada-like iteration (over a range say) rather than C/C++ like iteration you are also stuck. > All of the above points are related: the context should determine the > type of a literal. Then, after overload resolution has determined the > type of a literal, there should be a compile-time check that it is of > the right form -- the form should not *determine* the type. Eg, if the > type of 1.2 turns out to be Integer, that should be illegal. If the > type of 1.2 could be either Integer or Float, that should be ambiguous > and therefore illegal, whereas in Ada, it chooses Float. OK, I'm convinced. Maybe this next generation language should be named "Grace" or "Hopper" ;-) -- Brian