On 8/16/2020 12:18 PM, adrianv wrote:
You're actually trivializing that task of determining if a variable holds a
vector.
No, I'm not trivializing it. Rather, I was asking why you want to do
it. And you've answered that (at least for parameters): earlier and
better error messages, and polymorphism.
How can I possibly know if
X = f(1,2,3);
leaves X set equal to a vector or not?
For function returns, I'm inclined to say "because that's what f is
defined to return, and you've tested it and are confident that it's
correct". You need to be able to do that with most functions, or you
will go insane checking their results.
Of course a test suite might do arbitrarily complex verification of a
function's results - but that's not a production use case.
On 8/16/2020 12:18 PM, adrianv wrote:
> You're actually trivializing that task of determining if a variable holds a
> vector.
No, I'm not trivializing it. Rather, I was asking why you want to do
it. And you've answered that (at least for parameters): earlier and
better error messages, and polymorphism.
> How can I possibly know if
>
> X = f(1,2,3);
>
> leaves X set equal to a vector or not?
For function returns, I'm inclined to say "because that's what f is
defined to return, and you've tested it and are confident that it's
correct". You need to be able to do that with most functions, or you
will go insane checking their results.
Of course a test suite might do arbitrarily complex verification of a
function's results - but that's not a production use case.