Hacker News new | past | comments | ask | show | jobs | submit login
Rust for C++ programmers – part 5: borrowed references (featherweightmusings.blogspot.ch)
18 points by hobo_mark on May 6, 2014 | hide | past | favorite | 2 comments



This might be a silly question (I've spent my whole career in languages that don't offer much control), but: does it matter - with regard to these borrowed references - whether the item is on the heap or the stack, or can one have borrowed references to either?

I'm guessing the answer is the latter since I believe "let x = 5" in the examples doesn't box the integer. But I thought I should ask to confirm that suspicion.


You can have references to values on the heap or on the stack, and to whole objects or to single fields in a struct/enum/tuple/vector (though that might freeze the whole containing object).




Consider applying for YC's Spring batch! Applications are open till Feb 11.

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

Search: