
From a very quick study of this, this radical proposal avoids nasty brackets "pi()" by adding a new C++ keyword implicit to make "pi" have the same effect.
One could write: double pi() implicit // << Note new keyword here. { return 3.145926; } and double circumference = pi * diameter; // Note No nasty ()s and more usefully: and template<class T = double> T pi() implicit // << Note new keyword here. { return 3.1459265358793; } and specialisations like: template<> float pi<float>() { return 3.1459F; } template<> myVeryLongDouble pi<myVeryLongDouble >() { // UserDefined floating point Type. return 3.1459265358793432986549023478943257; } template<> int pi<int >() { // For indiana Legislature lawyers only ;-) return 3; } and define functions like template<class T> T area (T radius) { return pi<T> * radius * radius; } Language design implications is way outside my competence, but "implicit" sweetens a serious language nastiness. Pragmatically, I sense that a kludge, such as several people, most recently Daniel Frey, are working on promises a nasty but quicker partial solution for math constants. It would not seem much trouble to convert if the new keyword "implicit" is actually working, so I don't conclude we should stop the on-going battle to present math constants. Paul Paul A Bristow Prizet Farmhouse, Kendal, Cumbria UK LA8 8AB +44 1539 561830 +44 7714 330204 mailto: pbristow@hetp.u-net.com | -----Original Message----- | From: boost-bounces@lists.boost.org | [mailto:boost-bounces@lists.boost.org] On Behalf Of Beman Dawes | Sent: 10 March 2004 02:18 | To: Boost mailing list | Subject: [boost] Implicitly-Callable Functions in C++0x? | | There's a proposal (N1611) "Implicitly-Callable Functions in C++0x" by | Walter Brown in the C++ committee's pre-meeting papers. See | http://std.dkuug.dk/jtc1/sc22/wg21/docs/papers/2004/n1611.pdf