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,FREEMAIL_FROM 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: g2news1.google.com!news1.google.com!news.glorb.com!news2.glorb.com!news-xxxfer.readnews.com!textspool1.readnews.com!news-out.readnews.com!postnews7.readnews.com!not-for-mail Date: Thu, 17 Feb 2011 11:25:13 -0500 From: Hyman Rosen User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.13) Gecko/20101207 Thunderbird/3.1.7 MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: What's wrong with C++? References: <1ee1a434-4048-48f6-9f5e-d8126bebb808@r19g2000prm.googlegroups.com> <17coueqbf1p27.1g0wj3010saxe$.dlg@40tude.net> In-Reply-To: <17coueqbf1p27.1g0wj3010saxe$.dlg@40tude.net> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Message-ID: <4d5d4bec$0$13901$882e7ee2@usenet-news.net> NNTP-Posting-Host: 5e0982de.usenet-news.net X-Trace: DXC=Y\\CMGXMI0;Sa:gN]1kjmlC8HLM7[P4nTU3Ro`? X-Complaints-To: abuse@usenet-news.net Xref: g2news1.google.com comp.lang.ada:17339 Date: 2011-02-17T11:25:13-05:00 List-Id: On 2/17/2011 11:12 AM, Dmitry A. Kazakov wrote: > On Thu, 17 Feb 2011 08:38:25 -0500, Peter C. Chapin wrote: >> Could you elaborate a little on why you think type inference is bad? > >A variety of objections... And your objections are wrong because there are plenty of types that can usefully be inferred by the compiler and which can be written by the programmer only with difficulty (at least in C++). Iterators over containers are a prime example. If I have a C++ map and I look something up, I have to declare map::iterator i = my_map.find("hello"); But that's silly - the compiler knows what type that function returns, and it has a better chance of getting it right than I do: auto i = my_map.find("hello"); will be supported by soon-to-be-standard C++. For now, people dedicated to not sprinkling their code with these iterator types have to push to a type-inferring template: template void do_something(T i); do_something(my_map.find("hello"));