Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
borrowwhatnow
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
3 ms
·
1.
▲
by
borrowwhatnow
11y ago
True, but pointers don't have destructors in C++ or Rust, I think (and in C, there are no destructors at all, obvs).
2.
▲
by
borrowwhatnow
11y ago
I think I disagree with the "your code would be nutty in C" comment. Since C requires all variables to be declared at the top of the scope, and the order of declaration doesn't matter for purposes of allocation, there's
3.
▲
by
borrowwhatnow
11y ago
Well, that whole "ref" thing just shows my ignorance of Rust. Thanks for the information. > That would leave 'ref' dangling, if even for a moment, like here. That'd be bad. I'm not sure I agree that it would
4.
▲
by
borrowwhatnow
11y ago
> I'll assume you meant 'ref = &x' in your example. I did, thanks.
5.
▲
by
borrowwhatnow
11y ago
Congrats! I've been excited about Rust for a while now, and this gives me a good reason to look into it a bit more. A quick question, though, if it's appropriate in this context: It seems to me that the borrow checker disallows be