Re:Type-erased generic functions for C: A modest non-proposal
by randomdata on Friday October 04, 2024 @07:47PM
(#41746550)
> and then swapping in a language in which 1 and 1.0 do not quack
Except, no. This compiles and evaluates just fine in C++. Both quack the same quack.
int x = 1;
float y = 1;
x > y;
The previously provided code fails because of the use of typename, which explicitly calls for the compiler to evaluate the type based on name. That is literally the documented purpose of the keyword. And which is exactly what duck typing is not. Duck typing doesn't need a duck to actually be a duck. If a goose walks and quacks like a duck... Good enough!
> Anyway, your confusion may be easily resolved by perusing the following link.
Imagine having such little understanding of what you are talking about that you can't do it and have to defer to the work of others. Why even bother participating in a discussion at all if you can't speak to it yourself? It is especially humorous when that work of someone else doesn't even state what it is purported to.
Except, no. This compiles and evaluates just fine in C++. Both quack the same quack.
The previously provided code fails because of the use of typename, which explicitly calls for the compiler to evaluate the type based on name. That is literally the documented purpose of the keyword. And which is exactly what duck typing is not. Duck typing doesn't need a duck to actually be a duck. If a goose walks and quacks like a duck... Good enough!> Anyway, your confusion may be easily resolved by perusing the following link.
Imagine having such little understanding of what you are talking about that you can't do it and have to defer to the work of others. Why even bother participating in a discussion at all if you can't speak to it yourself? It is especially humorous when that work of someone else doesn't even state what it is purported to.