Skip to contents

This function will new an instance using the ..new.. method, then initialized the instance with the ..init.. method.

Usage

BASE$instantiate(
  ...,
  env = new.env(parent = parent.frame()),
  init_call = sys.call()
)

Arguments

...

Arguments passed to ..init.. method.

env

Environment. The instance environment.

init_call

Call. Contents of the ..init_call... It is recommended to leave it as default.

Value

An instance environment.

Examples


BASE$..dir..()
#>  [1] "..doc_pkg.."      "..mro.."          "..str.."          "..len.."         
#>  [5] "..class.."        "..new.."          "..repr.."         "del_attr"        
#>  [9] "has_attr"         "set_attr"         "get_attr"         "..type.."        
#> [13] "..dir.."          "..methods.."      "..method_env.."   "..init.."        
#> [17] "..instantiated.." "..class_tree.."   "instantiate"     

# Build an instance
base_instance <- BASE$instantiate()

base_instance$..dir..()
#>  [1] "..doc_pkg.."      "..mro.."          "..str.."          "..len.."         
#>  [5] "..class.."        "..new.."          "has_attr"         "del_attr"        
#>  [9] "..repr.."         "set_attr"         "..type.."         "get_attr"        
#> [13] "..dir.."          "..methods.."      "..method_env.."   "..instantiated.."
#> [17] "..init.."         "..init_call.."    "..class_tree.."