It's not supported by the language, but there are C++ libraries that do
this, e.g., the Boost Parameter Library (see
http://www.boost.org/libs/parameter/doc/html/index.html).
Oh dear... it's all terribly clever, but does little to
dispel my private conviction that the OO priesthood, and
the C++ OO priesthood in particular, grows fat by making
an ego-trip out of a workaround.
It took me about ten minutes to learn how to use named
parameter association, and defaults, in VHDL. Despite
spending considerable periods since without doing any
VHDL at all, I've remembered it. I wonder how long it
would take for me to get familiar with the Boost
feature you referenced? And I wonder how well that
mass of detailed information would stick, if not
used daily?
Feature-rich libraries are a huge turn-off for people
(like me) who lack an encyclopaedic memory. I want
my core, lightweight, memorable language to meet my
halfway on my journey to an application, providing
me with the malleable tools I need to create the
stuff I want. Over-simplicity in the language
means re-inventing the wheel every time you want
to do something; excessive complexity in a set of
libraries has exactly the same effect, by making it
impossible to remember everything that's out there.
Of course there are obvious exceptions: for example,
if I want to write an application that grabs an HTTP
page from a website, I expect to be able to find a
library function somewhere that does the whole of
that rather complicated activity. I think my point
here is that libraries for well-defined application
requirements are fine, but libraries that attempt to
cover up for alanguage's deficiencies by providing
a meta-toolkit are likely to be either very inflexible,
or absurdly complicated to learn and deploy.
Just my ignorant $0.02-worth; I'm not a "real" C++
programmer at all (thank heavens).
--
Jonathan Bromley, Consultant
DOULOS - Developing Design Know-how
VHDL * Verilog * SystemC * e * Perl * Tcl/Tk * Project Services
Doulos Ltd., 22 Market Place, Ringwood, BH24 1AW, UK
(e-mail address removed)
http://www.MYCOMPANY.com
The contents of this message may contain personal views which
are not the views of Doulos Ltd., unless specifically stated.