Andrei Alexandrescu (born 1969) is a Romanian-American C++ and D language programmer and author. He is particularly known for his pioneering work on policy-based design implemented via template metaprogramming. These ideas are articulated in his book Modern C++ Design and were first implemented in his programming library, Loki. He also implemented the "move constructors" concept in his MOJO library. He contributed to the C/C++ Users Journal under the byline "Generic<Programming>". Alexandrescu worked as a research scientist at Facebook, before departing the company in August 2015 in order to focus on developing the D programming language.
Alexandrescu at ACCU 2009
|Born||1969 (age 49–50)|
|Education||Politehnica University of Bucharest and University of Washington|
|Occupation||Developer of the D programming language|
|Known for||Expert on C++ and D programming|
Education and career
Alexandrescu received a B.S. degree in Electrical Engineering from Polytechnic University of Bucharest (Universitatea Politehnica din Bucureşti) in July 1994.
His first article was published in the C/C++ Users Journal in September 1998. He was a program manager for Netzip, Inc. from April 1999 until February 2000. When the company was acquired by RealNetworks, Inc., he served there as a development manager from February 2000 through September 2001.
Expected is a template class for C++ which is on the C++ Standards track. Alexandrescu proposes Expected<T> as a class for use as a return value which contains either a T or the exception preventing its creation, which is an improvement over use of either return codes or exceptions exclusively. Expected can be thought of as a restriction of sum (union) types or algebraic datatypes in various languages, e.g., Hope, or the more recent Haskell and Gallina; or of the error handling mechanism of Google's Go, or the Result type in Rust.
He explains the benefits of Expected<T> as:
- Associates errors with computational goals
- Naturally allows multiple exceptions in flight
- Switch between error handling and exception throwing styles
- Teleportation possible across thread boundaries, across nothrow subsystem boundaries and across time (save now, throw later)
- Collect, group, combine exceptions
For example, instead of any of the following common function prototypes:
int parseInt(const string&); // Returns 0 on error and sets errno.
int parseInt(const string&); // Throws invalid_input or overflow
he proposes the following:
Expected<int> parseInt(const string&); // Returns an expected int: either an int or an exception
- Andrei Alexandrescu (February 2001). Modern C++ Design: Generic Programming and Design Patterns Applied. Addison-Wesley. ISBN 978-0-201-70431-0.
- Herb Sutter, Andrei Alexandrescu (November 2004). C++ Coding Standards: 101 Rules, Guidelines, and Best Practices. Addison-Wesley. ISBN 978-0-321-11358-0.
- Andrei Alexandrescu (June 2010). The D Programming Language. Addison-Wesley. ISBN 978-0-321-63536-5.
- Metz, Cade (7 July 2014). "The Next Big Programming Language You've Never Heard Of". Wired.com. Wired. Retrieved 27 July 2014.
Today, Alexandrescu is a research scientist at Facebook, where he and a team of coders are using D to refashion small parts of the company's massive operation.
- Alexandrescu, Andrei (1 February 2003). "Move Constructors". Dr. Dobb's Journal. Archived from the original on 7 May 2009. Retrieved 25 March 2009.
- "Moving forward with work on the D language and foundation". 25 August 2015. Retrieved 28 August 2015.
- Reddit.com: "Sixteen years ago, at 28, I landed in New York with $300 to my name. Today I became a US citizen. It's been a wild ride that I hope will go on!"
- Andrei Alexandrescu: Resumé Archived 7 April 2011 at the Wayback Machine
- ACCU Spring Conference 2001 Archived 11 August 2011 at the Wayback Machine
- ACCU 2008: Speakers
- ACCU 2010: Speakers
- Computer Science & Engineering, Recent Ph.D. Graduates (Summer 2009). University of Washington.
- [Botet; Talbot. "A proposal to add a utility class to represent expected monad" (PDF). Archived from the original (PDF) on 19 August 2014.
- Alexandrescu. "Systematic Error Handling in C++".
- Alexandrescu's homepage - Contains links to downloadable Loki libraries for various compilers.
- (in Romanian) Interviu MONEY.ro: Facebook face angajări în România, 1 March 2010