N4174: Call syntax: x.f(y) vs. f(x,y) -- Bjarne Stroustrup

A new WG21 paper is available. If you are not a committee member, please use the comments section below or the std-proposals forum for public discussion.

Document number: N4174

Date: 2014-10-11

Call syntax: x.f(y) vs. f(x,y)

by Bjarne Stroustrup

Excerpt:

This note explores the possibility of providing a uniform call syntax by giving member functions preference over non-member functions. Offering the choice between the x.f(y) and f(x,y) notations with different meanings means that different people will chose differently for their function definitions, so that users have to know the choice and write calls appropriately. This gives users more opportunities for making mistakes, makes it harder to write generic code, and has led to replication when people define both a member and a non-member function to express the same thing. I suggest that providing different meanings to the two syntaxes offers no significant advantage.

Add a Comment

Comments are closed.

Comments (0)

There are currently no comments on this entry.