fn find<‘a,K,V>(tbl: &’a Hashtable,
key: &K)
-> Option<&’a V>
{
...
}
pointer with
lifetime ‘a to table
Slide 39
Slide 39 text
fn find<‘a,K,V>(tbl: &’a Hashtable,
key: &K)
-> Option<&’a V>
{
...
}
pointer with
lifetime ‘a to table
pointer with lifetime ‘a
to value
Slide 40
Slide 40 text
template
class Hashtable
V& Hashtable::find(K& key);
unsafe!
Slide 41
Slide 41 text
CONCURRENCY
Slide 42
Slide 42 text
Heap
Slide 43
Slide 43 text
Heap
Slide 44
Slide 44 text
let (port, chan) = stream();
do spawn {
let p = ~Point { x: 1.0, y: 2.0 };
chan.send(p);
}
let p = port.recv();
printfln!(p.to_str());
Slide 45
Slide 45 text
• Pluggable I/O
• Optional scheduler
• Data race-free shared data structures
• Potential for race-free fork-join parallelism
• Working on SIMD and GPU libs
There’s more
1. Don’t use unsafe code.
2. If you absolutely must break Rule 1,
• get out of unsafe code ASAP, and
• always provide a safe interface at the
boundaries.
The rules
Slide 50
Slide 50 text
Low-level programming… without the segfaults.
Slide 51
Slide 51 text
Thank you.
Slide 52
Slide 52 text
Image credits
Sean Martell
http://blog.seanmartell.com
Ben Clinch
http://www.flickr.com/photos/benclinch/3048906022/
juicyrai
http://www.flickr.com/photos/wink/180979062/
Rama, Wikimedia Commons
http://en.wikipedia.org/wiki/File:Sir_Tony_Hoare_IMG_5125.jpg
Jared Zimmerman
http://www.flickr.com/photos/spoinknet/7932382540/
CCAC North Library
http://www.flickr.com/photos/ccacnorthlib/3553821699/
Mike Hayes
http://www.flickr.com/photos/rotties/449650275/