mesos-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ben Mahler" <benjamin.mah...@gmail.com>
Subject Re: Review Request 33558: Add C++11 lambdas to the C++ style guide.
Date Tue, 28 Apr 2015 02:08:14 GMT

-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/33558/#review81769
-----------------------------------------------------------

Ship it!


Thanks! I'm curious, when we would ever use capture by reference? Seems prone to lifetime
bugs.


docs/mesos-c++-style-guide.md
<https://reviews.apache.org/r/33558/#comment132229>

    When would we use capture by reference? Seems prone to mistakes?



docs/mesos-c++-style-guide.md
<https://reviews.apache.org/r/33558/#comment132230>

    Can you post the rendered markdown? Was this meant to be a bullet point? Does it render
correctly?



docs/mesos-c++-style-guide.md
<https://reviews.apache.org/r/33558/#comment132233>

    What does it mean to pass a lambda to `socket.send`? Doesn't look like this is functionality
provided on the existing socket we have, and I'm not sure what this would do.. provide a functor
of the data?



docs/mesos-c++-style-guide.md
<https://reviews.apache.org/r/33558/#comment132232>

    There is no "closing parenthesis" for a lambda..?



docs/mesos-c++-style-guide.md
<https://reviews.apache.org/r/33558/#comment132234>

    Hm.. this look a bit hard to read to me, you might think that the capture list is an argument
as you scan case 1, for example, and it might be hard to distinguish the lambda from other
arguments (consider if socket.send takes more arguments).
    
    Would it be better to illustrate the wrapping via a variable?
    
    ```
    auto lambda = [&capture1, &capture2, &capture3]
        (const T1& p1, const T2& p2, const T3& p3) {
          ...;
        };
    ```
    
    One last note, it seeems nice in many cases to keep the opening parenthesis with the parameters
rather than against the end of the capture list (e.g. as I did above). I realize that's not
clean to do when you have to wrap the parameters as well though, so maybe not :)


- Ben Mahler


On April 26, 2015, 8:26 p.m., Benjamin Hindman wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/33558/
> -----------------------------------------------------------
> 
> (Updated April 26, 2015, 8:26 p.m.)
> 
> 
> Review request for mesos, Ben Mahler, Joris Van Remoortere, Michael Park, and Vinod Kone.
> 
> 
> Repository: mesos
> 
> 
> Description
> -------
> 
> See summary. Note that there will be a follow up review which enacts this style in the
code base.
> 
> 
> Diffs
> -----
> 
>   docs/mesos-c++-style-guide.md fe98f90ad0b0f5dd38af97e85062e90cee8de99e 
> 
> Diff: https://reviews.apache.org/r/33558/diff/
> 
> 
> Testing
> -------
> 
> N/A
> 
> 
> Thanks,
> 
> Benjamin Hindman
> 
>


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message