Re: Anonymous functions: replace bind with lambdas

2016-08-28 Thread Guillaume Munch
Le 05/07/2016 à 20:39, Georg Baum a écrit : Guillaume Munch wrote: I have split the patch in two for you, and already committed the part that does not introduce lambda expressions. Attached is the remainder of the patch that replaces all remaining std::bind with lambda expressions. Thanks. I

Re: Anonymous functions: replace bind with lambdas

2016-07-09 Thread Guillaume Munch
Le 06/07/2016 22:37, Stephan Witt a écrit : Am 05.07.2016 um 21:39 schrieb Georg Baum : Thanks. I am currently swamped with work, and this deserves a thorough look so please be patient for a few days for my answer. Sure I’m not familiar with lambda

Re: Anonymous functions: replace bind with lambdas

2016-07-06 Thread Stephan Witt
Am 05.07.2016 um 21:39 schrieb Georg Baum : > > Guillaume Munch wrote: > >> I have split the patch in two for you, and already committed the part >> that does not introduce lambda expressions. Attached is the remainder of >> the patch that replaces all remaining

Re: Anonymous functions: replace bind with lambdas

2016-07-06 Thread Richard Heck
On 07/03/2016 05:36 PM, Guillaume Munch wrote: Le 03/07/2016 20:52, Richard Heck a écrit : One might wonder in such cases why things are being copied or passed by reference, for example. Unfortunately, while producing equivalent code is easy (or so it seems so far), fully understanding the

Re: Anonymous functions: replace bind with lambdas

2016-07-05 Thread Georg Baum
Guillaume Munch wrote: > I have split the patch in two for you, and already committed the part > that does not introduce lambda expressions. Attached is the remainder of > the patch that replaces all remaining std::bind with lambda expressions. Thanks. I am currently swamped with work, and this

Re: Anonymous functions: replace bind with lambdas

2016-07-03 Thread Guillaume Munch
Le 03/07/2016 20:52, Richard Heck a écrit : My own view is that our code is undercommented---and I know I'm as bad about this as anyone. That said, I often add comments to code I have to read to fix various bugs, if only for my own benefit later. I agree. I noticed myself doing that as well

Re: Anonymous functions: replace bind with lambdas

2016-07-03 Thread Richard Heck
On 07/03/2016 02:21 PM, Guillaume Munch wrote: > Le 27/06/2016 23:15, Richard Heck a écrit : >> On 06/27/2016 04:14 PM, Georg Baum wrote: >>> You mean std::bind, or did I miss any remaining boost::bind? > > I just removed some leftover boost::function (not boost::bind). > >>> For me personally the

Re: Anonymous functions: replace bind with lambdas

2016-07-03 Thread Guillaume Munch
Le 27/06/2016 23:15, Richard Heck a écrit : On 06/27/2016 04:14 PM, Georg Baum wrote: You mean std::bind, or did I miss any remaining boost::bind? I just removed some leftover boost::function (not boost::bind). For me personally the patch is too big to proof-read it. I'd prefer to change

Re: Anonymous functions: replace bind with lambdas

2016-06-27 Thread Richard Heck
On 06/27/2016 04:14 PM, Georg Baum wrote: > Guillaume Munch wrote: > >> Dear list, >> >> >> Here is a patch that removes all uses of std::bind and boost::bind in >> src/. I think this is something that we want in the long term, because >> it makes the changed code much more readable and

Re: Anonymous functions: replace bind with lambdas

2016-06-27 Thread Georg Baum
Guillaume Munch wrote: > Dear list, > > > Here is a patch that removes all uses of std::bind and boost::bind in > src/. I think this is something that we want in the long term, because > it makes the changed code much more readable and maintainable. You mean std::bind, or did I miss any

Re: Anonymous functions: replace bind with lambdas

2016-06-27 Thread Guillaume Munch
Le 26/06/2016 21:17, Richard Heck a écrit : It would help me if you could explain this new syntax. I'm a philosopher, not a programmer. -theApp()->registerSocketCallback(fd, -bind(::read_ready, this)); +theApp()->registerSocketCallback(fd, [this]() { read_ready();

Re: Anonymous functions: replace bind with lambdas

2016-06-26 Thread Richard Heck
On 06/26/2016 03:20 PM, Guillaume Munch wrote: + auto compile = [&](std::string const & s) { + return clone->doExport(s, true); + }; + return runAndDestroy(compile, orig, clone, format); This one, too, and the other auto one that follows it. rh

Re: Anonymous functions: replace bind with lambdas

2016-06-26 Thread Richard Heck
Some explanatory comments in this stuff would help, too. These complex constructions are nice in reducing code, but they are hard for novices to read without help. rh On 06/26/2016 03:20 PM, Guillaume Munch wrote: +namespace { + +template +typename std::result_of::type call(F f) {

Re: Anonymous functions: replace bind with lambdas

2016-06-26 Thread Guillaume Munch
As a sidenote: a related feature of Qt5 that is absent from Qt4.8 is the possibility to connect signals to arbitrary functions (including anonymous ones such as lambdas). Pros and cons from https://wiki.qt.io/New_Signal_Slot_Syntax: Pros * Compile time check of the existence of the signals and