- Overview
- Table of Contents
- Special Member Functions: Constructors, Destructors, and the Assignment Operator
- Operator Overloading
- Memory Management
- Templates
- Namespaces
- Time and Date Library
- Streams
- Object-Oriented Programming and Design Principles
- The Standard Template Library (STL) and Generic Programming
- Exception Handling
- Runtime Type Information (RTTI)
- Signal Processing
- Creating Persistent Objects
- Bit Fields
- New Cast Operators
- Environment Variables
- Variadic Functions
- Pointers to Functions
- Function Objects
- Pointers to Members
- Lock Files
- Design Patterns
- Dynamic Linking
- Tips and Techniques
- A Tour of C99
- C++0X: The New Face of Standard C++
- Reference Wrapper
- The Performance Technical Report
- auto for the People
- Ironing Templates' Syntactic Wrinkles
- Visual C++ Becomes ISO Compliant
- A Garbage Collector for C++
- C99 Core Features in C++0X
- The
shared_ptrClass - The shared_ptr Class, II
- Lambda Expressions and Closures, Part I
- Lambda Expressions and Closures, Part II
- Lambda Expressions and Closures, Part III
- The Type Traits Library, Part I
- The Type Traits Library, Part II
- The Type Traits Library, Part III
- finally Revisited
- The Any Library
- The nullptr Keyword Proposal
- Delegating Constructors
- The Explicit Conversion Operators Proposal
- Conditionally-Supported Behavior
- The weak ptr Class Template, Part I
- The weak ptr Class Template, Part II
- POD Types Revisited
- The rvalue Reference Proposal, Part I
- The rvalue Reference Proposal, Part II
- Proposal for New String Algorithms
- Concepts, Part I
- Concepts, Part II
- constexpr: Generalized Constant Expressions
- The constexpr Proposal: Constructors
- Strongly-Typed enum Types
- C++09: The Road Ahead
- C++09: Proposals by Statuses
- Changing Undefined Behavior to Diagnosable Errors
- New Character Types
- The __func__ Predeclared Identifier is Coming to C++
- Static Assertions
- The extern template Proposal
- Variadic Templates, Part I
- Variadic Templates, Part II
- Variadic Templates, Part III -- Critique
- Using unique_ptr, Part I
- Using unique_ptr, Part II
- Unrestricted Unions, Part I
- Unrestricted Unions, Part II
- Unrestricted Unions, Part III
- Types With No Linkage as Template Arguments
- New Initialization Syntax
- Initializer Lists and Sequence Constructors
- New Standard Library Algorithms
- Class Member Initializers
- Inheriting Constructors
- Introducing Attributes
- The Removal of Concepts From C++0x
- The Future of C++0x, Part I
- The Future of C++0X, Part II
- The Debate About Attributes, Part I
- The Debate About Attributes, Part II
- The Debate About Attributes, Part III
- The Debate About Attributes, Part IV
- Forward Declarations of Enum Types
- The SCARY Iterators Proposal, Part I
- The SCARY Iterators Proposal, Part II
- Heading for Deprecation: export, Exception Specification and register
- The Rejection of the Unified Function Syntax Proposal
- Rvalue References as Object Members
- C++0x Concurrency
- The Reflecting Circle New
- We Have Mail New
- The Soapbox
- Numeric Types and Arithmetic
- Careers
- Locales and Internationalization
The Rejection of the Unified Function Syntax Proposal
Last updated Nov 27, 2009.
A detailed proposal for replacing the auto-arrow style declaration of functions with a new syntax was rejected at the Santa Cruz meeting. That proposal was the collective work of several members, who'd been refining and refactoring it for a long time. Find out what that proposal was all about and why it was wasn't accepted into the Working Draft.
The auto-arrow Function Declarations
C++0x introduced a function declaration syntax whereby the auto type specifier and a -> return type are used. For example:
auto f() -> int;
is a declaration of a function called f which takes no parameters and returns int. The so-called "auto-arrow" syntax was problematic for various reasons, including parsing ambiguity and the confusion between auto as a storage type and the C++0x auto used for automatic type deduction (recall that the auto storage type was eventually removed from C++0x). For a detailed discussion about the problems with the above syntax see The Syntax of auto Declarations. It was therefore decided that the committee should pursue a new, unified function syntax for C++0x. The addition of lambda expressions and closures to C++0x inspired the authors to design a new notation that would be based the lambda syntax for all functions, including ordinary member functions and freestanding functions. Although the lambda notation seemed promising at first, the proposed uniform syntax was far from being consistent, clear or complete. It's not unusual to have proposals redesigned repeatedly until they're fully baked (or at least baked enough to be voted into the Working Draft). Take for example the lambda proposal. It was changed at least four times, including two major syntactic overhauls, and even today it still has some minor "loose ends". The unified function syntax proposal wasn't exceptional in this respect. But there were other factors that led to its demise. As one of the members said in his a pull-no-punches style:
[T]his proposal had good intentions, but that the realization of those intentions is horrible. ...[T]he syntax doesn't look readable, wouldn't help anyone understand the language better, and it's very late to be introducing something as optional as this proposal given how unstable the series of proposals have been and that the proposal doesn't fix a problem that needed to be addressed.
The unified function syntax proposal was rejected in Santa Cruz. I will not go through the complex and ever-changing technical details of the proposed syntax here. If you're interested, you can read the latest version here and get a glimpse of the proposed syntax.
Problems with the Unified Function Syntax
What was wrong with the unified function syntax? The minutes from the Santa Cruz meeting reveal that many members didn't like the proposed new syntax, which they found ugly and not very readable (it should be noted that similar comments were expressed in previous meetings). It also had no added value in terms of teachability. But other than the decorative aspects, there are other, more concrete problems with the proposal:
- You can't write casts to function types with the new syntax.
- Some new-style declarations require a typedef.
- One can not express a function that returns a function pointer with the new syntax.
All these corner cases might have been resolved later but the clock is ticking. There's simply no time for that. It's fairly safe to say that what hasn't made it into the WD yet (except for fixes) -- will have to wait for the C++1x standard.
Dry Your Tears
When I read C++0x new proposals, I have a habit of mentally marking them as either "looks good, even if it still requires polishing" or "I hope this never makes it into the standard". I can say that when I read the unified function syntax proposal I felt that it belonged to the latter category, along with the infamous Concepts. In The Practice of Programming, Brian Kernighan writes that one of his most productive days as a programmer was when he removed hundreds of lines of code from a project he was working on. At this stage, there is only one way to make the C++0x standard better --by removing features that aren't fully-baked, not by adding new ones. The rejection of the unified function syntax proposal was the right thing to do.


Account Sign In
View your cart