From: Paul A. Bristow (boost_at_[hidden])
Date: 2003-10-10 14:37:55
| -----Original Message-----
| From: boost-bounces_at_[hidden]
| [mailto:boost-bounces_at_[hidden]]On Behalf Of David Abrahams
| Sent: Sunday, October 05, 2003 9:57 PM
| To: boost
| Subject: [boost] Named function params
| In an attempt to improve on the interface used by the Boost.Graph
| library for named parameters, I came up with the enclosed scheme,
| which allows the following Python-like syntax:
| int x1 = f("x", 3.14, 22);
| int x2 = f(value = 3.14, name = "x");
| int x3 = f(value = 6.5);
| int x4 = f();
| int x5 = g("x", 3.14, 22);
| int x6 = g(value = 3.14, name = "x");
| int x8 = g("q", index = 77);
| I'm pretty proud of myself (;->) but I'm not too satisfied with how
| much code is required for someone wanting to write a new function
| accepting keyword arguments, and further I'm not sure how to design a
| good interface for automatically generating the boilerplate with the
| preprocessor. Consider that there may be initial non-keyword args,
| which might themselves be templated or not.
| I thought I'd open it up for suggestions. Thoughts, anyone?
Impressive - but won't this delay enhancement of the C++ language to add some
proper way of doing this? Named parameters is hardly a novel concept.
Or have we accepted this C++ is already fossilised?
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk