brodieG / vetr

Trust, but Verify
78 stars 2 forks source link

Rethink messages involving class and type #99

Closed brodieG closed 3 years ago

brodieG commented 4 years ago

We avoid using the function forms for clarity, but they might actually be worse. Compare:

> "[" <- function(x, i, ...) vetr(numeric(), numeric())
> mean[1:5]
Error in mean[i = 1:5] : 
  For argument `x`, `mean` should be type "numeric" (is "closure")

To maybe:

Error in mean[i = 1:5] : 
  For argument `x`, `typeof(mean)` should be "numeric" (is "closure")

This is a particularly challenging case due to the nature of [. Also, we don't internally use typeof, but rather vetr::type_of which is not ideal for message.

brodieG commented 3 years ago

Doesn't seem worth addressing.