Boost logo

Boost :

From: Howard Hinnant (hinnant_at_[hidden])
Date: 2000-07-23 10:32:31


David Abrahams wrote on 7/23/2000 11:07 AM
>Finally, I want to make a last-ditch plea to consider other naming
>conventions than "meta_" for this stuff.

Ok, I'll bite. I see no need to prefix every compile-time computation
object with "meta_" or "ct_" (or other similar conventions). Compile
time compuatation is evident from the syntax of its use. type_traits.hpp
is full of compile time compuations:

remove_const
remove_volatile
remove_cv
remove_pointer
remove_reference
remove_bounds
remove_all
is_same
is_const
is_volatile
...

I would have strongly argued against:

meta_remove_const
meta_remove_volatile
meta_remove_cv
meta_remove_pointer
meta_remove_reference
meta_remove_bounds
meta_remove_all
meta_is_same
meta_is_const
meta_is_volatile
...

It's just too wordy. The prefix "meta_" hasn't conveyed any more
information to me. I know that is_const (for example) is a "meta"
operation from the way I use it:

bool b = is_const<T>::value;

Similarly with IF:

typedef IF<flag, type1, type2>::RET my_type;

Ok, IF is a bad name (macro collision). And "if" is a bad name (keyword
collision). "meta_if" or "ct_if" is not too bad, unless they are part of
a grand scheme to blindly prepend every compile-time computation with
"meta_" or "if_". There are several other reasonable possibilities for
this particlular construct than "...if...":

typedef select <flag, type1, type2>::type my_type;
typedef choose <flag, type1, type2>::type my_type;
typedef choose_from<flag, type1, type2>::type my_type;
typedef pick <flag, type1, type2>::type my_type;
typedef pick2 <flag, type1, type2>::type my_type;
(thinking there might also be a pick3 where flag would take on 0, 1 or 2)
typedef get_one_of <flag, type1, type2>::type my_type;
typedef grab_one_of<flag, type1, type2>::type my_type;
typedef decide_on <flag, type1, type2>::type my_type;
...
Ok, I'm getting punchy. ;-) But hopefully my point is made: The set of
reasonable names is much bigger than "prefix_if".

I argue similarly for the other recently discussed "meta" operations.

-Howard


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk