Skip to content

In place mutability of S7 objects #437

Closed
@JosiahParry

Description

@JosiahParry

Is there a road map to offer in-place mutation of an S7 object?

Ideally, I would be able to create a method that update the value of the S7 object while returning another object.

Here is a bit of a contrived example based on what I'm working on.

my_job <- new_class("my_job", properties = list(status = class_character))

job_status <- new_generic("job_status", "job")

method(job_status, my_job) <- function(job) {
  # do something 
  new_status <- "computing"
  job@status <- new_status

  list(status = "computing", value = "some other derived value")
}

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