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] "..mro.."          "..str.."          "..len.."          "..class.."       
#>  [5] "..new.."          "..repr.."         "del_attr"         "has_attr"        
#>  [9] "set_attr"         "get_attr"         "..type.."         "..dir.."         
#> [13] "..methods.."      "..method_env.."   "..init.."         "..instantiated.."
#> [17] "..class_tree.."   "instantiate"     

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

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