You’re right. Jon Blow doesn’t seem to value the things that Rust explicitly has stated as its mission statement, and often takes his criticisms of Rust too far.
I used the wrong word there, because you’re right; the borrow-checker already handles all of the use-after-free stuff (and general memory safety problems) for you. I guess what I was really thinking about was something more along the lines of “ease of refactoring”, and since in other langauges the largest concern in that area is memory safety, I misconstrued the two. I think that reliance on the implicit behavior of the borrow-checker makes it harder to reason about the way that memory is being used in future maintenance; I should’ve been more clear about that. In terms of safety, explicit captures do nothing semantically that the borrow-checker doesn’t already.
In terms of compile-time speed, do you think that there’d be a difference in the compile time if closure namespaces were limited? I’m not familiar with the compiler internals, but my original reasoning was that with a smaller search space, the compiler would have to do less work to reason about the safety of a closure.
I’m not experienced enough with the Rust programming language to really say anything here. Where could I go to learn more?
Do you think then that closure capture annotations should be more restrictive than the original idea? Maybe we semantically define a nocapture to be a pure function, and the compiler is instructed to disallow function calls that don’t also explicitly state that they are also nocapture (i.e. functions that are also pure functions)? That seems potentially useful, but I’m unsure how difficult it would be to implement that, or whether or not it would be legitimately useful in practice. What do you think?
That makes sense, I hadn’t thought about that. What kind of syntax would be useful there then? Curly brackets and paretheses don’t work because of the reason you described, and any other syntax seems equally as unappealing, as it visually doesn’t make sense. For closures and functions, this might not be a problem (? i.e. I can’t think of a case right now), but for any of the benefits of explicit captures to be realized, the syntax should be consistent accross all use cases, and that doesn’t seem possible (or at least I’m not clever enough to think of it).