Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!news.swapon.de!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Marko Rauhamaa Newsgroups: comp.lang.python Subject: Re: Python vs C++ Date: Sat, 23 Aug 2014 10:27:11 +0300 Organization: A noiseless patient Spider Lines: 28 Message-ID: <874mx3acog.fsf@elektro.pacujo.net> References: <87fvgoj2i8.fsf@elektro.pacujo.net> <87siko9tlq.fsf@elektro.pacujo.net> <53F7B870.2010909@gmail.com> <53F7BCAB.7000507@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: mx05.eternal-september.org; posting-host="ff5cf27ef3d5b31f034d3b72bdc27a41"; logging-data="3945"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18S0xgI9Xb2IHmXTkGe4g2X" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux) Cancel-Lock: sha1:zPEeYLK2J3PHf/LBO33EqzYP+I8= sha1:MC4x+quardZcPJKRQYDPR7hyl0k= Xref: csiph.com comp.lang.python:76844 Chris Angelico : > I'm just saying that callbacks are inherently restrictive in a > language without first-class functions. You don't have to go that far to have great callback support. C# (and Delphi) show a great model that I wish C++ had adopted from the beginning. C++ could have declared that a function pointer contains the function pointer plus the (optional) this pointer. That would have dealt with the whole (important) issue. > So I'm not sure why you have further issue with C++; C's way of doing > callbacks works fine in C++, and there's not going to be anything > better. Well, C++11 brings in the lambda (): One of the biggest beneficiaries of lambda functions are, no doubt, power users of the standard template library algorithms package. Previously, using algorithms like for_each was an exercise in contortions. Using void pointers in C++ is like sacrificing to the idols. Marko