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-17 15:46:28 PST Newsgroups: comp.lang.ada Path: supernews.google.com!sn-xit-03!supernews.com!cyclone-sf.pbi.net!63.208.208.143!feed2.onemain.com!feed1.onemain.com!newsfeed.icl.net!dispose.news.demon.net!demon!colt.net!news.tele.dk!134.222.94.5!npeer.kpnqwest.net!uunet!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: Sat, 17 Mar 2001 23:45:01 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:5820 Date: 2001-03-17T23:45:01+00:00 List-Id: Brian Rogoff writes: > # let rec len l = match l with [] -> 0 | x::xs -> 1 + len xs;; > > Hey, where are the types? Is this like Lisp? No, not really, here is what > the top level says when I enter that > > val len : 'a list -> int = > > So the system *infers* the type, and a very general type, for that > function. It takes a list of anything to an integer. I didn't even need > to instantiate a generic for that. Pretty spiffy, huh? No. I don't find it spiffy to have to read down into the guts of that function to find out that it returns an 'int'. Nor do I find it spiffy that the type of a literal is determined by what it looks like. I think the type of a literal should be determined from context. I think type inference is spiffy within (small) expressions, but I think interfaces should have explicitly declared types, including functions like the above 'len'. I understand that in ML you *can* declare signatures, *if you like*. I don't know OCaml, unfortunately. - Bob