Python from Wise Guy's Viewpoint
Brian McNamara!
gt5163b at prism.gatech.edu
Sat Oct 25 15:17:25 EDT 2003
j-anthony at rcn.com (Jon S. Anthony) once said:
>gt5163b at prism.gatech.edu (Brian McNamara!) writes:
>
>> boost::tuple to then generalize things. (Indeed, using such libraries,
>> you can simulate "apply" rather convincingly. But somewhere under the
>> hood, someone has to have written N different overloads for 0-arg,
>> 1-arg, ... N-arg, up to some fixed ("large enough") N.)
>
>That's not actually good enough. You also have to have overloads for
>all the possible types for 1-arg, ..., N-arg. Actually it's worse
>than that - the set of types is not closed, so even in principle this
>won't work.
I'm not sure I understand you, but if I do, then "templates" take care
of this. That is, we'd write (e.g. for the 3-arg case):
template <class A, class B, class C>
Result someFunc( A a, B b, C c ); // fudging "Result" for simplicity
which means that someFunc works "forall" types A, B, and C.
--
Brian M. McNamara lorgon at acm.org : I am a parsing fool!
** Reduce - Reuse - Recycle ** : (Where's my medication? ;) )
More information about the Python-list
mailing list