tune icon indicating copy to clipboard operation
tune copied to clipboard

give .notes an extra class

Open topepo opened this issue 6 years ago • 3 comments

so that we can have a typesum method that prints something like <0w3e> or similar

topepo avatar Oct 25 '19 14:10 topepo

Wait on https://github.com/r-lib/pillar/issues/173

We could not use vctrs::list_of and make our own list class that holds tbl_notes, but I'd rather use vctrs

DavisVaughan avatar Nov 12 '19 21:11 DavisVaughan

Why not keep.notes a list column and just add a class to the tibble that we get back from the output?

EDIT I guess my title implied giving the whole column a class. I'd rather the elements of the list have a class.

topepo avatar Nov 12 '19 22:11 topepo

I tried that, and I think we need to do that, but the way it currently works with pillar is:

  • pillar:::pillar_shaft.list is called to generate the whole pillar column
  • It calls pillar:::obj_sum.list to format the column elements
  • Unfortunately that function is just map_chr(x, obj_sum.default) (map over the elements of the list, which would be our notes tibbles, and call the default obj_sum)

And pillar:::obj_sum.default does not give us enough control. It really should be pillar::obj_sum (the generic) in my opinion but that didn't happen. An issue requesting that that happen (r-lib/pillar#137) was closed in favor of using the vctrs_list_of method, but that isn't enough either

DavisVaughan avatar Nov 12 '19 22:11 DavisVaughan