Language

CppCon 2015: John Lakos “Value Semantics: It ain’t about the syntax!, Part II”



CppCon

http://www.Cppcon.org

Presentation Slides, PDFs, Source Code and other presenter materials are available at: https://github.com/cppcon/cppcon2015

When people talk about a type as having *value* *semantics*, they are often thinking about its ability to be passed to (or returned from) a function by value. In order to do that, the C++ language requires that the type implement a copy constructor, and so people routinely implement copy constructors on their classes, which begs the question, “Should an object of that type be copyable at all?” If so, what should be true about the copy? Should it have the same state as the original object? Same behavior? What does copying an object mean?! By *value* *type*, most people assume that the type is specifically intended to represent a member of some set (of values). A *value-semantic* *type*, however, is one that strives to approximate an abstract *mathematical* type (e.g., integer, character set, complex-number sequence), which comprises operations as well as values. When we copy an object of a value-semantic type, the new object might not have the same state, or even the same behavior as the original object; for proper value-semantic types, however, the new object will have the same *value*. In this talk, we begin by gaining an intuitive feel for what we mean by *value* by identifying *salient* *attributes*, i.e., those that contribute to value, and by contrasting types whose objects naturally represent values with those that don’t. After quickly reviewing the syntactic properties common to typical value types, we dive into the much deeper issues that *value* *semantics* entail. In particular, we explore the subtle *Essential* *Property* *of* *Value*, which applies to every *salient* mutating operation on a value-semantic object, and then profitably apply this property to realize a correct design for each of a variety of increasingly interesting (value-semantic) classes.

John Lakos, author of “Large Scale C++ Software Design.”, serves at Bloomberg LP in New York City as a senior architect and mentor for C++ Software Development world-wide. He is also an active voting member of the C++ Standards Committee, Library Working Group. Previously, Dr. Lakos directed the design and development of infrastructure libraries for proprietary analytic financial applications at Bear Stearns. For 12 years prior, Dr. Lakos developed large frameworks and advanced ICCAD applications at Mentor Graphics, for which he holds multiple software patents. His academic credentials include a Ph.D. in Computer Science (’97) and an Sc.D. in Electrical Engineering (’89) from Columbia University. Dr. Lakos received his undergraduate degrees from MIT in Mathematics (’82) and Computer Science (’81). His next book, entitled “Large-Scale C++, Volume I: Process and Architecture”, is anticipated in 2014.

Videos Filmed & Edited by Bash Films: http://www.BashFilms.com .

Source

Similar Posts

One thought on “CppCon 2015: John Lakos “Value Semantics: It ain’t about the syntax!, Part II”

Comments are closed.

WP2Social Auto Publish Powered By : XYZScripts.com