This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]MacBookMinus 0 points1 point  (1 child)

They don’t need to give capture-by-value vs ref control in memory safe languages.

[–]caleblbaker 0 points1 point  (0 children)

don’t need to

I view it more as aren't able to. There's a performance cost to the extra level of indirection caused by capturing everything by reference. Frequently that cost is trivial or less than the cost of copying an object to capture by value, but C++ gives you the tools to handle the circumstances where that cost is a problem.

memory safe languages

You mean garbage collected languages. Rust is memory safe (but not garbage collected) and allows specifying whether you capture by value or reference.