It’s almost over! D:”

Here’s an update on my project with Mozilla Rust:

I’ve spent the past several weeks experimenting with the concepts of references and named lifetime parameters in Rust.  This, I believe, is my key to avoiding the .clone() operator.  Borrowed pointers are one way Rust ensures memory safety.  The compiler will only accept a borrowed pointer to memory if it can guarantee that the memory being borrowed will not be changed in any way throughout the duration of the borrow.  This protects the user from such nuisances as dangling pointers, which you might encounter in C or C++.  In my code, I need to return these references (another name for borrowed pointers), which complicates the issue of working with them.  In order to continue to assure memory safety, I use named lifetimes to state explicitly to the compiler the span for which the reference will be valid. This ends up working because, typically (and this is the case in my code as well) one only returns references if they are derived from the function’s parameters.  I am continuing to enhance my understanding of these concepts as I work with them!  So perhaps someday I can give an even better explanation–maybe I’ll even write some documentation!

I am heading across the country soon to conclude my internship in the company of my collaborators.  I will hope to have daily (?!) blog posts discussing my role at the work week and what I learned there!  I’m starting to reflect on my experience with this internship and I am really taken aback by how much I learned in the process.  I am now familiar on a deep level with a language I barely knew at the start.  Even though, it looks like, at this rate, my library will not be finished by the end of the internship, I have left a well-designed framework for whoever steps up to the challenge of creating a b-tree in Rust next…which might still be me!

Advertisements
This entry was posted in Uncategorized and tagged , , , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s