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 07:26:05 PST Newsgroups: comp.lang.ada Path: supernews.google.com!sn-xit-02!supernews.com!news.tele.dk!209.50.235.254!europa.netcrusader.net!152.163.239.130!portc01.blue.aol.com!uunet!dca.uu.net!ash.uu.net!world!bobduff From: Robert A Duff Subject: Re: Static typing (Was Re: Better support for garbage collection) Sender: bobduff@world.std.com (Robert A Duff) Message-ID: Date: Mon, 19 Mar 2001 15:24:05 GMT 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> Organization: The World Public Access UNIX, Brookline, MA X-Newsreader: Gnus v5.3/Emacs 19.34 Xref: supernews.google.com comp.lang.ada:5843 Date: 2001-03-19T15:24:05+00:00 List-Id: Brian Rogoff writes: > So you can program entirely with explicit types in ML if you wish. Yeah, I know. I just think it should be *required* at the interfaces. > Of course Nick's complaint is about all of the extra code with explicit > types, and its that argument I responded to. While I agree with you that > inference shouldn't be used everywhere, I think Ada goes way too far in > having redundant types, and explicit instantiation everywhere. For all of > its egregious flaws, I think C++ got this right with implicit > instantiation of templated functions. I think trying to duplicate the STL > in Ada convinced me of that, though rather than go to C++ (which I find > awful) or a dynamically typed language I started looking at ML and kin. I agree. > 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. 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. 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. 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. - Bob