Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

rust just got 4x more productive [shill thread]

Name: Anonymous 2016-12-16 15:09

Rust designers developed an idiom for concisely propagating errors outwards with a macro called try!:
let file = try!(File::open("file.txt"));
More recently, Rust shipped an even more concise notation for error propagation, the postfix ? operator:
let file = File::open("file.txt")?;

Name: Anonymous 2017-01-19 15:18

>>41
To add on to this, if C didn't have null pointers, programmers would probably resort to putting something like the following in the global scope:

char junk;
void * const null = &junk;


This would allow the programmer to simulate null pointers by following the convention that any pointer pointing to the variable 'junk' be treated as a pointer to invalid data. 'junk' could be used for something to avoid wasting memory, so long as no attempt is ever made to access it through a pointer.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List