* Warren D Smith <warren.wds@gmail.com> [Apr 21. 2014 06:49]:
[...]
Re some other stuff, like C++ templates, in fact my compile-time ideas would do that better. For example, suppose you wrote a SORT routine for int32's. You now want same sort routine but for int64's, int8's etc. OK just do
#for( T in {int8, int32, int64} ){ SORT routine defined here using type T }
and voila. Here #for is a for loop executed at compile time. You want a compile time language very much like the actual language albeit restricted in power (do not allow it to be turing undecidable whether it compiles... incidentally C++ fails that test and hence should have been dismissed right there; it actually is Turing undecidable whether your C++ program is valid C++, which is just a mind-boggling level of language-design incompetence and incredible testament to how crufty it is).
template <typename Type> void sort_whatever(Type *x, int n) { ... } will sort any Type if all operations in the routine are defined for Type. And templates are not functions, the corresponding functions are generated at compile time. And then, it's all there, ready to go (again!): http://www.cplusplus.com/reference/algorithm/sort/ Best, jj
_______________________________________________ math-fun mailing list math-fun@mailman.xmission.com http://mailman.xmission.com/cgi-bin/mailman/listinfo/math-fun