Is there any official way to show the definition of class methods in R5 using the R5 generator object?
> cls <- setRefClass("cls", methods = list(f1 = function() {1})) > > # of course we can get the definition via the instance > a1 <- new("cls") > a1$f1 Class method definition for method f1() function () { 1 } <environment: 0x101d5d3f0> > > # but how to get the difinition via the generator object, ie, cls? > cls$f1 Error in envRefInferField(x, what, getClass(class(x)), selfEnv) : 'f1' is not a valid field or method name for reference class "refGeneratorSlot" > > # here is a workaround, but probably unofficial and no warranty for future behavior > cls$def@refMethods $f1 Class method definition for method f1() function () { 1 }
cls@generator $def@refMethods $f1
This does not create an instance. Probably not canonical or stable, though.
Source: https://habr.com/ru/post/948327/More articles:https://translate.googleusercontent.com/translate_c?depth=1&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/948322/how-to-copy-several-monticello-commits-from-local-repository-to-smalltalkhubcom-automatically&usg=ALkJrhiLGTzlZNucPHu4QyY0c4fmTmJAswfatal: remote hero already exists - gitAngularjs: insert underscore in $ scope - angularjsUsing Get-childitem to get a list of files modified in the last 3 days - powershell3 different types of JavaScript objects, what's the difference? - javascriptAuto-binding for boost :: thread in C ++? - c ++Only 1 y tag in GNUplot multiset - gnuplotgit rebase cannot execute editor - gitStop task without ThrowIfCancellationRequested - multithreadingAsynchronously interrupt C # TPL tasks - c #All Articles