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,ab1d177a5a26577d X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news2.google.com!Xl.tags.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local2.nntp.dca.giganews.com!news.giganews.com.POSTED!not-for-mail NNTP-Posting-Date: Fri, 18 Feb 2011 07:37:29 -0600 Newsgroups: comp.lang.ada Date: Fri, 18 Feb 2011 08:37:10 -0500 From: "Peter C. Chapin" Subject: Re: What's wrong with C++? In-Reply-To: Message-ID: References: <1ee1a434-4048-48f6-9f5e-d8126bebb808@r19g2000prm.googlegroups.com> <17coueqbf1p27.1g0wj3010saxe$.dlg@40tude.net> User-Agent: Alpine 2.00 (WNT 1167 2008-08-23) X-X-Sender: pcc09070@vtc.vsc.edu@webmail.vtc.edu MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Usenet-Provider: http://www.giganews.com X-Trace: sv3-ZLVPfabEdi8fxMttNThoaldN5bqMWlEWHS68h9Moi0Fj/kb47e1b9Io6evlXz1+44NJfCq2NZhLhNKm!W/OQfEfM9ZEo92PeuVCw6a/L9CmjmqbSRpFZJvKL1CYMnv7e7pAHaQxNRyDgedMkwloNetMdiA== X-Complaints-To: abuse@giganews.com X-DMCA-Notifications: http://www.giganews.com/info/dmca.html X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.40 X-Original-Bytes: 3169 Xref: g2news2.google.com comp.lang.ada:18393 Date: 2011-02-18T08:37:10-05:00 List-Id: On Fri, 18 Feb 2011, Chuck wrote: >> You can still define the types you need. Inference just means that you >> typically don't have to bother with explicit declarations: create the >> objects you need (of the types you need) and let the compiler work out >> the details. > > And the the MAINTAINER try to figure out WTF is going on with the > UNREADABLE code! Uncomprehensible code is useless code. I agree that rampant type inference isn't good for readibility. But as has been mentioned here elsewhere, even languages that support aggressive type inference typically require type annotations in interfaces (aka specifications). Anyway, I like the way Scala does type inference. You do have to annotate parameter types of methods but the compiler can infer the types on locals and also on function literals that are embedded inside other expressions. For instance: def simpleMethod(counters: List[Int]) = counters filter { _ > 1 } In this trivial example the compiler infers the type of the function literal as Int => Boolean based on its use as a argument to the filter method as applied to a list of integers. The return type of simpleMethod is also inferred as a list of integers as well (the result of filter). The fact that you have to annotate the parameter types and yet don't have to bother annotating all the local types seems like a good compromise between documentation and conciseness. In any case, functional languages are becoming industrially significant. Microsoft is fully supporting F# (an OCaml dialect) and Scala is doing well in the Java ecosystem. I think we will see more of this sort of thing in the future rather than less. Peter