Hacker News
new
|
past
|
comments
|
ask
|
show
|
jobs
|
submit
login
saghm
3 months ago
|
parent
|
context
|
favorite
| on:
Rust's Block Pattern
My instinct is this would get hairy much faster if you want to actually close over variables compared to using a block.
ahartmetz
3 months ago
|
next
[–]
Not sure if that is relevant to your point, but: For better and for worse, closing over any outer scope variables is syntactically free in Rust lambdas. You just access them.
nicoburns
3 months ago
|
parent
|
next
[–]
It's syntactically free, but it can cause borrow-checker errors thst cause your code to outright fail to compile.
saghm
3 months ago
|
root
|
parent
|
next
[–]
Yes, exactly. My concerns were semantic, not syntactic.
loeg
3 months ago
|
prev
[–]
If the verbose return type syntax can't be elided, I think it's more or less dead as a pattern.
Guidelines
|
FAQ
|
Lists
|
API
|
Security
|
Legal
|
Apply to YC
|
Contact
Search: