brodieG / vetr

Trust, but Verify
78 stars 2 forks source link

numerics not recognized as integer-like when NAs are present #90

Closed franknarf1 closed 6 years ago

franknarf1 commented 6 years ago

In 0.1.0 this passed, I think:

vet(integer(), c(20170101, NA))

But now in 0.2.2, it does not. I guess the previous behavior was correct... can't figure why vet(integer(), 20170101) should pass but the example above fail.

Anyway, not a real problem, since I use actual integers in practice, not integer-like numerics. I just had lines like the above as a quick way of verifying that my token behaved as expected and can add trailing Ls to it so it works again. Thanks

brodieG commented 6 years ago

Hmm, interesting. I'll need to think about what the actual correct behavior is here. Not obvious what the answer should be. Also I wouldn't have thought that would be a behavior change, but I'll have to look into it. Thanks for reporting.

brodieG commented 6 years ago

So, looking at the commit history, it looks like this was an explicit decision, although the commit message is pretty useless in explaining why. That said, I think fundamentally there is no way of knowing if NAreal is an integer like number or not, so it seems safer to assume that it might not be. You could argue the other side ("well, you don't know that it isn't an integer..."), but that is a more aggressive interpretation.