You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@mesos.apache.org by Alex Clemmer <cl...@gmail.com> on 2016/12/01 23:46:13 UTC

Review Request 54271: Disambiguate return type of lambda passed to `Future::then`.

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

Review request for mesos, Anand Mazumdar, Benjamin Hindman, and Joseph Wu.


Repository: mesos


Description (updated)
-------

Fixes build break for OS X 10.10.4, Apple LLVM version 6.1.0
(clang-602.0.53) (based on LLVM 3.6.0svn), introduced by
c33ba209d226fb91874b00976298faf278a29369.

In `process::http::internal::sendfile`, a lambda function is passed to a
call to `Future<T>::then`:

    [=]() mutable {
      // NOTE: the file descriptor gets closed by FileEncoder.
      Encoder* encoder = new FileEncoder(fd.get(), s.st_size);
      return send(socket, encoder)
        .onAny([=]() {
        delete encoder;
        });
    }

This lambda function is intended to return a `Future<Nothing>`, which in
turn is returned by `sendfile` (i.e., `sendfile` is meant to return a
`Future<Nothing>`). But, on the machine specified above, the compiler
infers the type of this lambda to be `Future<Future<Nothing>>`.  This
causes a compiler error, since `sendfile` is supposed to return a plain
old `Future<Nothing>`.

The fix is to simply alter the signature of the labmda to give the
compiler a hint:

    [=]() mutable -> Future<Nothing> {

Review: https://reviews.apache.org/r/54271


Diffs (updated)
-----

  3rdparty/libprocess/src/http.cpp ac406e2e5c2d9b38ec453a74cf47ee5f80a875df 

Diff: https://reviews.apache.org/r/54271/diff/


Testing
-------


Thanks,

Alex Clemmer


Re: Review Request 54271: Disambiguated return type of lambda passed to `Future::then`.

Posted by Joseph Wu <jo...@mesosphere.io>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/54271/#review157693
-----------------------------------------------------------


Ship it!




Ship It!

- Joseph Wu


On Dec. 1, 2016, 3:48 p.m., Alex Clemmer wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/54271/
> -----------------------------------------------------------
> 
> (Updated Dec. 1, 2016, 3:48 p.m.)
> 
> 
> Review request for mesos, Anand Mazumdar, Benjamin Hindman, and Joseph Wu.
> 
> 
> Repository: mesos
> 
> 
> Description
> -------
> 
> Fixes build break for OS X 10.10.4, Apple LLVM version 6.1.0
> (clang-602.0.53) (based on LLVM 3.6.0svn), introduced by
> c33ba209d226fb91874b00976298faf278a29369.
> 
> In `process::http::internal::sendfile`, a lambda function is passed to a
> call to `Future<T>::then`:
> 
>     [=]() mutable {
>       // NOTE: the file descriptor gets closed by FileEncoder.
>       Encoder* encoder = new FileEncoder(fd.get(), s.st_size);
>       return send(socket, encoder)
>         .onAny([=]() {
>         delete encoder;
>         });
>     }
> 
> This lambda function is intended to return a `Future<Nothing>`, which in
> turn is returned by `sendfile` (i.e., `sendfile` is meant to return a
> `Future<Nothing>`). But, on the machine specified above, the compiler
> infers the type of this lambda to be `Future<Future<Nothing>>`.  This
> causes a compiler error, since `sendfile` is supposed to return a plain
> old `Future<Nothing>`.
> 
> The fix is to simply alter the signature of the labmda to give the
> compiler a hint:
> 
>     [=]() mutable -> Future<Nothing> {
> 
> Review: https://reviews.apache.org/r/54271
> 
> 
> Diffs
> -----
> 
>   3rdparty/libprocess/src/http.cpp ac406e2e5c2d9b38ec453a74cf47ee5f80a875df 
> 
> Diff: https://reviews.apache.org/r/54271/diff/
> 
> 
> Testing
> -------
> 
> 
> Thanks,
> 
> Alex Clemmer
> 
>


Re: Review Request 54271: Disambiguated return type of lambda passed to `Future::then`.

Posted by Mesos ReviewBot <re...@mesos.apache.org>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/54271/#review157692
-----------------------------------------------------------



Patch looks great!

Reviews applied: [54271]

Passed command: export OS='ubuntu:14.04' BUILDTOOL='autotools' COMPILER='gcc' CONFIGURATION='--verbose' ENVIRONMENT='GLOG_v=1 MESOS_VERBOSE=1'; ./support/docker_build.sh

- Mesos ReviewBot


On Dec. 1, 2016, 11:48 p.m., Alex Clemmer wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/54271/
> -----------------------------------------------------------
> 
> (Updated Dec. 1, 2016, 11:48 p.m.)
> 
> 
> Review request for mesos, Anand Mazumdar, Benjamin Hindman, and Joseph Wu.
> 
> 
> Repository: mesos
> 
> 
> Description
> -------
> 
> Fixes build break for OS X 10.10.4, Apple LLVM version 6.1.0
> (clang-602.0.53) (based on LLVM 3.6.0svn), introduced by
> c33ba209d226fb91874b00976298faf278a29369.
> 
> In `process::http::internal::sendfile`, a lambda function is passed to a
> call to `Future<T>::then`:
> 
>     [=]() mutable {
>       // NOTE: the file descriptor gets closed by FileEncoder.
>       Encoder* encoder = new FileEncoder(fd.get(), s.st_size);
>       return send(socket, encoder)
>         .onAny([=]() {
>         delete encoder;
>         });
>     }
> 
> This lambda function is intended to return a `Future<Nothing>`, which in
> turn is returned by `sendfile` (i.e., `sendfile` is meant to return a
> `Future<Nothing>`). But, on the machine specified above, the compiler
> infers the type of this lambda to be `Future<Future<Nothing>>`.  This
> causes a compiler error, since `sendfile` is supposed to return a plain
> old `Future<Nothing>`.
> 
> The fix is to simply alter the signature of the labmda to give the
> compiler a hint:
> 
>     [=]() mutable -> Future<Nothing> {
> 
> Review: https://reviews.apache.org/r/54271
> 
> 
> Diffs
> -----
> 
>   3rdparty/libprocess/src/http.cpp ac406e2e5c2d9b38ec453a74cf47ee5f80a875df 
> 
> Diff: https://reviews.apache.org/r/54271/diff/
> 
> 
> Testing
> -------
> 
> 
> Thanks,
> 
> Alex Clemmer
> 
>


Re: Review Request 54271: Disambiguated return type of lambda passed to `Future::then`.

Posted by Alex Clemmer <cl...@gmail.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/54271/
-----------------------------------------------------------

(Updated Dec. 1, 2016, 11:48 p.m.)


Review request for mesos, Anand Mazumdar, Benjamin Hindman, and Joseph Wu.


Summary (updated)
-----------------

Disambiguated return type of lambda passed to `Future<T>::then`.


Repository: mesos


Description
-------

Fixes build break for OS X 10.10.4, Apple LLVM version 6.1.0
(clang-602.0.53) (based on LLVM 3.6.0svn), introduced by
c33ba209d226fb91874b00976298faf278a29369.

In `process::http::internal::sendfile`, a lambda function is passed to a
call to `Future<T>::then`:

    [=]() mutable {
      // NOTE: the file descriptor gets closed by FileEncoder.
      Encoder* encoder = new FileEncoder(fd.get(), s.st_size);
      return send(socket, encoder)
        .onAny([=]() {
        delete encoder;
        });
    }

This lambda function is intended to return a `Future<Nothing>`, which in
turn is returned by `sendfile` (i.e., `sendfile` is meant to return a
`Future<Nothing>`). But, on the machine specified above, the compiler
infers the type of this lambda to be `Future<Future<Nothing>>`.  This
causes a compiler error, since `sendfile` is supposed to return a plain
old `Future<Nothing>`.

The fix is to simply alter the signature of the labmda to give the
compiler a hint:

    [=]() mutable -> Future<Nothing> {

Review: https://reviews.apache.org/r/54271


Diffs
-----

  3rdparty/libprocess/src/http.cpp ac406e2e5c2d9b38ec453a74cf47ee5f80a875df 

Diff: https://reviews.apache.org/r/54271/diff/


Testing
-------


Thanks,

Alex Clemmer