Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.mixmin.net!weretis.net!feeder4.news.weretis.net!cs.uu.nl!news.stack.nl!newsfeed.xs4all.nl!newsfeed3a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'languages,': 0.04; 'subject:Python': 0.06; 'c++,': 0.07; 'referring': 0.07; 'statically': 0.07; 'pointers': 0.09; 'typed': 0.09; 'cc:addr :python-list': 0.11; 'python': 0.11; '(void': 0.16; '23,': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'lambda': 0.16; 'objects.': 0.16; 'run-time.': 0.16; 'sat,': 0.16; 'all.': 0.16; 'language': 0.16; 'wrote:': 0.18; 'aug': 0.22; 'saying': 0.22; 'cc:addr:python.org': 0.22; "aren't": 0.24; 'either.': 0.24; 'lets': 0.24; 'fine': 0.24; 'cc:2**0': 0.24; 'compiled': 0.26; 'pass': 0.26; 'header:In-Reply-To:1': 0.27; 'function': 0.29; 'michael': 0.29; 'chris': 0.29; 'am,': 0.29; 'message-id:@mail.gmail.com': 0.30; "i'm": 0.30; 'quite': 0.32; "can't": 0.35; 'but': 0.35; 'received:google.com': 0.35; 'c++': 0.36; 'functions.': 0.36; 'doing': 0.36; 'list': 0.37; 'issue': 0.38; 'pm,': 0.38; 'anything': 0.39; 'sure': 0.39; 'either': 0.39; 'further': 0.61; 'great': 0.65; 'boost': 0.70; 'to:none': 0.92 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=M7KrMKJ+9XKbaIBN1y+MK0k+ZicuzDCFFX9IYHVddww=; b=gjPymxCj3I9UrFL26D1JLLUrGh4//3Gz+/vTWuVxAGFGLyRdIaSQC+sg2GVuP64h17 t91+ynnoEZOm8WkYrCUg2UoDxgASNW/v2KWHUcozr41wTTkhLKU0Mqlm6nSUErk8dSVF WYGEOQoT4DXdMqibylfv8ni27ukv51gjZJI0tx1lsm2yQzA8tldIhNO0EMuLT2Clrfwn QB2K+9iLCelgqNty8NJgPCwXln0SYpVJ/gpJuX0DRVJYp91gUP67ssWQ1NAZf7yRtlR/ htW9CACa/vY/1bte4uY6EimUIvMAq4PPhoUoPgaxTIrDfeWSD4lC9ST00ihNK6du6brh LoNA== MIME-Version: 1.0 X-Received: by 10.50.176.202 with SMTP id ck10mr1446829igc.2.1408744859110; Fri, 22 Aug 2014 15:00:59 -0700 (PDT) In-Reply-To: <53F7BCAB.7000507@gmail.com> References: <87fvgoj2i8.fsf@elektro.pacujo.net> <87siko9tlq.fsf@elektro.pacujo.net> <53F7B870.2010909@gmail.com> <53F7BCAB.7000507@gmail.com> Date: Sat, 23 Aug 2014 08:00:59 +1000 Subject: Re: Python vs C++ From: Chris Angelico Cc: "python-list@python.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 19 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1408744862 news.xs4all.nl 2968 [2001:888:2000:d::a6]:56887 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:76828 On Sat, Aug 23, 2014 at 7:56 AM, Michael Torrie wrote: > On 08/22/2014 03:49 PM, Chris Angelico wrote: >> My main issue with callbacks in either C or C++ is that functions >> aren't first-class objects. You can pass function pointers around (and >> you don't need (void *) to do it, you can use typed function pointers >> just fine), but you can't actually construct a function at run-time. > > I'm not sure I fully understand your meaning. You seem to prefer > dynamic languages, which is great because this is the Python list after > all. I'm not sure I know of any statically compiled language that lets > one construct a function at run-time. I know Boost supports lambda > functions but I'm not sure this is quite what you are referring to either. Right, I'm just saying that callbacks are inherently restrictive in a language without first-class functions. 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. ChrisA