Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

The difference is negligible in real syntax:

    auto my_closure = [](int x, int y) { return x + y; };

    let  my_closure = |x: int, y: int| { x + y }
and frankly, the option of an explicit capture-list with aliases and mixing moves and copies is a benefit:

    int sum = 0, diff = 0;
    
    auto adder = [&sum](int num) {
        sum += num;
    
        // compilation error, author didn't
        // mean to capture diff.
        diff -= num;
    };


Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: