Skip to content

Revisit special casing of vec_ptype2.logical.list() #819

Description

@DavisVaughan

See #812 (comment)

vec_ptype2.logical.list() was special cased to not allow vec_assign(list(1), 1, NA), but vec_assign(list(1), 1, unspecified(1)) happened to slip through because it isn't caught by that method. This special case complicates the vec_type2() C code and is why I need vec_ptype2_dispatch_unspecified_list().

I personally think that vec_assign(list(1), 1, NA) should be allowed, and is well defined. NA is cast to list(NULL), and then assigned.

So my suggestion would be to:

  • Remove vec_ptype2.logical.list() entirely, and let vec_ptype2.logical.default() be called

  • Remove the C level vec_ptype2_dispatch_unspecified_list() special case (remove C level stop_incompatible_type() if we do this)

  • Update the test in test-slice-assign.R to allow NA to be assigned into lists (and continue monitoring the existing test that unspecified() can also be assigned into lists)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions