Skip to content

Replace .validLHS() with tryCatch()? #88

Description

@krivit

The ultimate test of whether something can be assigned to is to actually try assigning to it.

It may therefore make sense to replace the

  if(.validLHS(xn,parent.frame())){  #If x not anonymous, set in calling env 
    on.exit(eval.parent(call('<-', xn, x)))
  }
  invisible(x) 

pattern with the much simpler

  on.exit(try(eval.parent(call('<-', xn, x)), silent = TRUE))
  invisible(x) 

or, since we don't care about the try-error object,

  on.exit(tryCatch(eval.parent(call('<-', xn, x)), error = function(e){}))
  invisible(x) 

Thoughts? @CarterButts ?

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