On Saturday, August 20th, 2022 at 10:04 PM, Sebastian Wittmeier <wittmeier@projectalpha.org> wrote:

isn't the aim (or one of it) of generic programming to use function templates as a function and especially class templates as a class?

Alexander Stepanov, the person who coined
the term "generic programming," has
emphasized many times: generic programming
is not‚Äč about how to use templates. The first
version of STL is done in Scheme. Generic
programming is an idea, templates is only a
way to approach this idea.

 

You say, a "protocol" is a function in a truer sense than a template function. In what ways and where is this useful? 


The top of the thread pointed out that a
function template, given the recent efforts
of improvements, still does not look like
normal code. A function that takes type
parameter declared with a protocol not only
looks like "normal code," it has to look like
normal code. It can also support separate
compilation, in other words, builds like
normal code.

--
Zhihao Yuan, ID lichray
The best way to predict the future is to invent it.
_______________________________________________