Python vs C++

Chris Angelico rosuav at gmail.com
Fri Aug 22 18:00:59 EDT 2014


On Sat, Aug 23, 2014 at 7:56 AM, Michael Torrie <torriem at gmail.com> 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



More information about the Python-list mailing list