Andrei Alexandrescu

Last updated

Andrei Alexandrescu
AndreiAlexandrescu.jpg
Alexandrescu at ACCU 2009
Born1969 (age 5455)
Nationality Romanian, American [2]
Education Politehnica University of Bucharest and University of Washington
OccupationDeveloper of the D programming language
Known forExpert on C++ and D programming [3]
SpouseSanda Alexandrescu
Website erdani.org

Andrei Alexandrescu (born 1969) is a Romanian-American C++ and D language [3] 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. [4] He contributed to the C/C++ Users Journal under the byline "Generic<Programming>".

Contents

He became an American citizen in August 2014. [5]

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. [6] [7]

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. [6]

Alexandrescu earned a M.S. (2003) and a PhD (2009) in computer science from the University of Washington. [8] [9] [10]

In 2006 Alexandrescu began assisting Walter Bright on the development of the D programming language. [11] He released a book titled The D Programming Language in May 2010.

From 2010 to 2014, Alexandrescu, Herb Sutter, and Scott Meyers ran a small annual technical conference called C++ and Beyond.

Alexandrescu worked as a research scientist at Facebook for over 5 years, before departing the company in August 2015 in order to focus on developing the D programming language. [12]

In January 2022, Alexandrescu began working at Nvidia as a Principal Research Scientist. [13]

Contributions

Expected

Expected is a template class for C++ which is on the C++ Standards track. [14] [15] Alexandrescu proposes [16] 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:

Example

For example, instead of any of the following common function prototypes:

int parseInt(const string&); // Returns 0 on error and sets errno.

or

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

Scope guard

From 2000 [17] onwards, Alexandrescu has advocated and popularized the scope guard idiom. He has introduced it as a language construct in D. [18] It has been implemented by others in many other languages. [19] [20]

Bibliography

Related Research Articles

Java and C++ are two prominent object-oriented programming languages. By many language popularity metrics, the two languages have dominated object-oriented and high-performance software development for much of the 21st century, and are often directly compared and contrasted. Java's syntax was based on C/C++.

In computer science, a recursive descent parser is a kind of top-down parser built from a set of mutually recursive procedures where each such procedure implements one of the nonterminals of the grammar. Thus the structure of the resulting program closely mirrors that of the grammar it recognizes.

<span class="mw-page-title-main">C++</span> General-purpose programming language

C++ is a high-level, general-purpose programming language created by Danish computer scientist Bjarne Stroustrup. First released in 1985 as an extension of the C programming language, it has since expanded significantly over time; as of 1997, C++ has object-oriented, generic, and functional features, in addition to facilities for low-level memory manipulation for making things like microcomputers or to make operating systems like Linux or Windows. It is almost always implemented as a compiled language, and many vendors provide C++ compilers, including the Free Software Foundation, LLVM, Microsoft, Intel, Embarcadero, Oracle, and IBM.

Generic programming is a style of computer programming in which algorithms are written in terms of data types to-be-specified-later that are then instantiated when needed for specific types provided as parameters. This approach, pioneered by the ML programming language in 1973, permits writing common functions or types that differ only in the set of types on which they operate when used, thus reducing duplicate code.

In computer science, imperative programming is a programming paradigm of software that uses statements that change a program's state. In much the same way that the imperative mood in natural languages expresses commands, an imperative program consists of commands for the computer to perform. Imperative programming focuses on describing how a program operates step by step, rather than on high-level descriptions of its expected results.

Template metaprogramming (TMP) is a metaprogramming technique in which templates are used by a compiler to generate temporary source code, which is merged by the compiler with the rest of the source code and then compiled. The output of these templates can include compile-time constants, data structures, and complete functions. The use of templates can be thought of as compile-time polymorphism. The technique is used by a number of languages, the best-known being C++, but also Curl, D, Nim, and XL.

<span class="mw-page-title-main">D (programming language)</span> Multi-paradigm system programming language

D, also known as dlang, is a multi-paradigm system programming language created by Walter Bright at Digital Mars and released in 2001. Andrei Alexandrescu joined the design and development effort in 2007. Though it originated as a re-engineering of C++, D is now a very different language drawing inspiration from other high-level programming languages, notably Java, Python, Ruby, C#, and Eiffel.

<span class="mw-page-title-main">Syntax highlighting</span> Tool of editors for programming, scripting, and markup

Syntax highlighting is a feature of text editors that is used for programming, scripting, or markup languages, such as HTML. The feature displays text, especially source code, in different colours and fonts according to the category of terms. This feature facilitates writing in a structured language such as a programming language or a markup language as both structures and syntax errors are visually distinct. This feature is also employed in many programming related contexts, either in the form of colorful books or online websites to make understanding code snippets easier for readers. Highlighting does not affect the meaning of the text itself; it is intended only for human readers.

In computer programming, specifically object-oriented programming, a class invariant is an invariant used for constraining objects of a class. Methods of the class should preserve the invariant. The class invariant constrains the state stored in the object.

Resource acquisition is initialization (RAII) is a programming idiom used in several object-oriented, statically typed programming languages to describe a particular language behavior. In RAII, holding a resource is a class invariant, and is tied to object lifetime. Resource allocation is done during object creation, by the constructor, while resource deallocation (release) is done during object destruction, by the destructor. In other words, resource acquisition must succeed for initialization to succeed. Thus the resource is guaranteed to be held between when initialization finishes and finalization starts, and to be held only when the object is alive. Thus if there are no object leaks, there are no resource leaks.

In some programming languages, const is a type qualifier, which indicates that the data is read-only. While this can be used to declare constants, const in the C family of languages differs from similar constructs in other languages in that it is part of the type, and thus has complicated behavior when combined with pointers, references, composite data types, and type-checking. In other languages, the data is not in a single memory location, but copied at compile time for each use. Languages which use it include C, C++, D, JavaScript, Julia, and Rust.

<i>Modern C++ Design</i> Book by Andrei Alexandrescu

Modern C++ Design: Generic Programming and Design Patterns Applied is a book written by Andrei Alexandrescu, published in 2001 by Addison-Wesley. It has been regarded as "one of the most important C++ books" by Scott Meyers.

<span class="mw-page-title-main">Syntax (programming languages)</span> Set of rules defining correctly structured programs

In computer science, the syntax of a computer language is the rules that define the combinations of symbols that are considered to be correctly structured statements or expressions in that language. This applies both to programming languages, where the document represents source code, and to markup languages, where the document represents data.

The curiously recurring template pattern (CRTP) is an idiom, originally in C++, in which a class X derives from a class template instantiation using X itself as a template argument. More generally it is known as F-bound polymorphism, and it is a form of F-bounded quantification.

In the C++ programming language, the assignment operator, =, is the operator used for assignment. Like most other operators in C++, it can be overloaded.

In C++ computer programming, allocators are a component of the C++ Standard Library. The standard library provides several data structures, such as list and set, commonly referred to as containers. A common trait among these containers is their ability to change size during the execution of the program. To achieve this, some form of dynamic memory allocation is usually required. Allocators handle all the requests for allocation and deallocation of memory for a given container. The C++ Standard Library provides general-purpose allocators that are used by default, however, custom allocators may also be supplied by the programmer.

In the C++ programming language, decltype is a keyword used to query the type of an expression. Introduced in C++11, its primary intended use is in generic programming, where it is often difficult, or even impossible, to express types that depend on template parameters.

In C++ computer programming, copy elision refers to a compiler optimization technique that eliminates unnecessary copying of objects.

In the C, C++, and D programming languages, a type qualifier is a keyword that is applied to a type, resulting in a qualified type. For example, const int is a qualified type representing a constant integer, while int is the corresponding unqualified type, simply an integer. In D these are known as type constructors, by analogy with constructors in object-oriented programming.

Although C++ is one of the most widespread programming languages, many prominent software engineers criticize C++ for being overly complex and fundamentally flawed. Among the critics have been: Robert Pike, Joshua Bloch, Linus Torvalds, Donald Knuth, Richard Stallman, and Ken Thompson. C++ has been widely adopted and implemented as a systems language through most of its existence. It has been used to build many pieces of very important software.

References

  1. "Erdani.com".
  2. andralex (14 August 2014). "No". Reddit. Archived from the original on 16 June 2022.
  3. 1 2 Metz, Cade (7 July 2014). "The Next Big Programming Language You've Never Heard Of". 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.
  4. Alexandrescu, Andrei (1 February 2003). "Move Constructors". Dr. Dobb's Journal . Archived from the original on 7 May 2009. Retrieved 25 March 2009.
  5. "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! : pics". 14 August 2014.
  6. 1 2 "Andrei Alexandrescu: Resumé". Archived from the original on 7 April 2011.
  7. ACCU Spring Conference 2001 Archived 11 August 2011 at the Wayback Machine
  8. "ACCU :: Speakers". members.accu.org.
  9. "ACCU :: Speakers". members.accu.org.
  10. Computer Science & Engineering, Recent Ph.D. Graduates (Summer 2009).mark University of Washington.
  11. "About Andrei Alexandrescu, PhD".
  12. "Moving forward with work on the D language and foundation". 25 August 2015. Retrieved 28 August 2015.
  13. "Andrei Alexandrescu". LinkedIn.com. Retrieved 15 December 2023.
  14. [Botet; Talbot. "A proposal to add a utility class to represent expected monad" (PDF). Archived from the original (PDF) on 19 August 2014.
  15. "STD-make/P0323r2.md at master · viboes/STD-make". GitHub . 21 October 2021.
  16. Alexandrescu. "Systematic Error Handling in C++". Archived from the original on 25 April 2013.
  17. Andrei Alexandrescu; Petru Marginean. "Generic: Change the Way You Write Exception-Safe Code – Forever". Archived from the original on 1 October 2012.
  18. "Exception Safety - D Programming Language".
  19. "Scope::Guard - lexically-scoped resource management - metacpan.org". metacpan.org.
  20. "Scopeguard - Rust".