Skip to content

don't return run invisibly #35

Closed
Closed

Description

@bart6114

Any specific reason why run() returns invisibly?
I personally think the below should automatically call show/print (i.e. not return invisibly).

simmer() %>%
  add_resource("server") %>%
  add_generator("test", t0, at(0)) %>%
  run()

Activity

  1. Enchufa2 commented on Dec 8, 2015

    @Enchufa2
    Member

    Mmmh... not specially. I supposed that it could be desirable to be able to do something like this:

    env %>% run(15) %>% onestep() %>% onestep()

    or this:

    env <- simmer() %>%
      add_resource("server") %>%
      add_generator("test0", t0, function() 1) %>%
      run(100) %>%
      add_generator("test1", t0, function() 2) %>%
      run(200) %>%
      del_generator("test0") %>%
      run(300)
  2. bart6114 commented on Dec 8, 2015

    @bart6114
    MemberAuthor

    If we replace all - not only $run() - invisible(self) with self in the Simmer R6 class we can still do this. And if it isn't saved in a variable it simply calls the $print function:

    > simmer() %>% run(15) %>% onestep() %>% onestep()
    Simmer environment: anonymous | now: 0 | next: Inf
    

    and

    > env<- simmer() %>% run(15) %>% onestep() %>% onestep()
    > 
    
  3. Enchufa2 commented on Dec 8, 2015

    @Enchufa2
    Member

    Certainly. When you're right, you're right. 😄

  4. added this to the v3.1.0 milestone on Dec 8, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions