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

You're correct, but there's a bit of "linguistic drift" at play, I guess. The use of the term "closure" in the Swift ecosystem has come to refer almost entirely to the anonymous kind.

(Side note, named functions in Swift are indeed also closures:

    let x = 10
    func f() {
        print(x)
    }
    f()    // Okay; prints 10 as you'd expect

)


Yeah, that seems to be the case in the JS community as well – I see a lot of people referring to the arrow function syntax as "closures", even though named functions are closures in JS too.




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

Search: