Python vs C++
Marko Rauhamaa
marko at pacujo.net
Sat Aug 23 03:27:11 EDT 2014
Chris Angelico <rosuav at gmail.com>:
> 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 (<URL:
http://www.cprogramming.com/c++11/c++11-lambda-closures.html>):
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
More information about the Python-list
mailing list