getMethods()
is an R.oo generic in R
(>= 4.5.0), whereas in versions before that it is n
methods generic. This is because
methods::getMethods()
is being deprecated in base R.hashCode(s)
implementation for strings was
rewritten to avoid integer overflow (see below bug fix). As a
consequence, the computed hash is no longer the same for some
strings.hashCode(s)
could return NA, due to integer overflow,
for strings with more than 13-15 symbols,
e.g. hashCode("abcdefghijklmno")
resulted in a missing
value and a warning.showNews()
for Package
recognizes
‘NEWS.md’ files too.\emph{}
at the end of
@howtocite
sections, because it now triggers an
R CMD check --as-cran
NOTE. The workaround was used to
workaround an R CMD check
false positive way back in 2004,
which has since been fixed.$<-
and [[<-
for
Object
to the list of S3 methods that tries to ignore
objects of class Object
that are of the kind that
R.oo creates. This fixes conflicts with
Object
objects that the arrow package
produces, which are non-R.oo objects. Other S3
Object
methods already do this since R.oo
1.20.0 to workaround similar issues with the rJava
package.getDate()
for Package
returned NA because
it was looking for DESCRIPTION field Date
, which has been
renamed to Date/Publication
.throw()
, which previously was a
re-export of ditto from R.methodsS3. This change
prevents the message “Registered S3 method overwritten by ‘R.oo’: …
throw.default R.methodsS3” from appearing when the R.oo
package is loaded (directly or indirectly).gc()
for Object
.
Use clearCache(..., gc = TRUE)
.example(getBundle.Package)
because they may
take more than 5 seconds when run on CRAN where
installed.packages()
will take a long time due to many
thousands of packages.clone()
is always created. This
avoids the recurring issues where the creation of generic
R.oo::clone()
was skipped if another clone()
generic already existed during package installation from source. This
would in turn cause for instance the R.utils package to
fail during loading (R.utils Issue #29). Thanks to Matt
Dowle for reporting on this and insisting on a fix.Removed previously defunct update()
for
Package
; use update.packages()
.
Removed previously defunct registerFinalizer()
for
Object
.
Previous deprecated gc()
for Object
is
now defunct; use clearCache(..., gc = TRUE)
instead.
[[<-
for Object
and BasicObject
failed when running
R CMD check
in R-devel (>= 3.6.0) with environment
variables _R_S3_METHOD_LOOKUP_BASEENV_AFTER_GLOBALENV
and
_R_S3_METHOD_LOOKUP_USE_TOPENV_AS_DEFENV
both set to
TRUE.Now TAB-completion works on elements of Object
,
BasicObject
, and Class
.
Now getElement()
works also for Object
,
Class
, and BasicObject
.
[[()
for Object
, Class
and
BasicObject
gained argument exact
, but
exact = FALSE
is currently ignored and treated as
exact = TRUE
.
Some S3 methods for R.oo classes
Object
and Exception
would interfere with
ditto for rJava objects that had class attributes
containing "Object"
and "Exception"
. Although
these classes have the same name, and therefore are in conflict, they
represent completely different classes. For methods where conflicts have
been identified, the R.oo implementations will try to
detect the conflict and call the next method instead.
Now print()
and startupMessage()
for
Package
report on package date only if date
exists.
CLEANUP: Explicit namespace imports also from utils package.
CLEANUP: Drop unused code.
clazz[[method]]()
for Class
object
clazz
did not call the intended static method, as
clazz$<method>()
would do.
getClasses()
for Package
would return
NULL.
Now explicitly declare “default” S3 methods for
getClasses()
and getMethods()
.
Dropped non-ASCII characters from R source comments.
Now charToInt()
returns integers as documented (was
numerics).
objectSize()
for environment could result in
infinite recursive calls if there circular dependencies between
environments. Added package test for objectSize()
including
this case.
getKnownSubclasses()
for Class
could
throw an error if one of the objects “scanned” for being a function and
of class Class
would thrown an error from just looking at
it. See R-devel thread ‘Inspect a “delayed” assigned whose value throws
an error?’ on 2015-01-26 for details.
Forgot to explicitly import getClasses()
and
getMethods()
from the methods package.
Interestingly, this one has never given an error.
getStaticInstance()
for Object
now
searches the parent/calling environment as well. This covers the case
when constructors and objects are created in a local environment
(contrary to package namespaces and the global environment).
update()
for Package
is defunct; use
update.packages()
.decreasing
to ll()
,
e.g. ll(sortBy = "objectSize", decreasing = TRUE)
.Rdoc$compile()
and Rdoc tag @allmethods
failed to provide links and titles on non-exported S3 methods.Rdoc$getRdUsage()
escapes %*%
to
\%*\%
in the Rd output.getRdDeclaration()
, getRdHierarchy()
,
and getRdMethods()
for Class
handles also
non-exported methods and classes.Object
:s no longer
calls finalize()
on the Object
itself unless
the R.oo package is loaded, whereas previously it would
have tried to temporarily reattach the R.oo package. On
the other hand, it is now sufficient to have R.oo
loaded for finalize()
to be called, whereas in the passed
it also had to be attached.gc()
for Object
. Use
clearCache(..., gc = TRUE)
instead.properties
of ll()
defaults to an
options, which if not set in turn defaults to a given value. The
ll()
method is no longer trying to set that option if
missing. The option is also no longer set when the package is
attached.Class$forName()
searches all loaded namespaces as a
last resort.Now static method Class$forName()
accepts optional
envir
argument for specifying from where to search for the
Class
object.
Added argument ‘gc = FALSE’ to clearCache()
. It is
recommended to start using clearCache(obj, gc = TRUE)
instead of gc(obj)
.
registerFinalizer()
for
Object
.finalizer()
registered for
Object
while loading the R.oo package
itself would cause cyclic loading of R.oo. The reason
was that it checked whether R.oo was available or not,
by only looking at attached namespaces but not loaded ones. This bug was
introduced in R.oo 1.16.0.importFrom()
and
S3method()
statements to the NAMESPACE file.Object()
to specify
whether a finalizer should be registered or not. If so, then generic
function finalize()
is called on the Object
.
Furthermore, extend()
for Object
gained
argument ...finalize
, which, regardless of argument
finalize
of Object
, force the registration of
a finalizer (...finalize = TRUE
) or the removal of one
(...finalize = FALSE
). If ...finalize = NA
(default), then the finalizer is enabled/disabled according to argument
finalize
of Object
. For backward compatibility
reasons, the default behavior is still to register a finalizer for
Object
:s, but this may change in a future release.Object
finalizers will no longer try to re-attach
the R.oo package if library()
is in the
process of trying to attach another package, because otherwise a cyclic
loading of namespaces may occur. This was observed for a package that
allocated a temporary Object
.onAttach()
which
then was garbage collected and finalized.R CMD INSTALL
. This may be
because a Package
object (R.oo::R.oo
) is
assigned during the loading of the namespace. Since Package
extends()
an Object
object, this may end up
loading R.oo again. To avoid this,
R.oo::R.oo
is now assigned using delayed assignment.inherits = FALSE
in several internal
exists()
/get()
calls.@howToCite
does a better job when there
are multiple citations in CITATION.getCall()
from stats,
iff R (>= 2.14.0).Package
object is also
available when the package is only loaded (but not attached).Deprecated update()
for
Package
.
Deprecated non-used registerFinalizer()
for
Object
.
R.methodsS3::appendVarArgs()
.extend()
for
Object
:s assumed that the utils is
attached while calling capture.output()
, which under
certain conditions could generate ‘Error in getObjectInfo(this) : could
not find function “capture.output”’ while the garbage collector was
running. In extreme cases it could also crash R.library("R.oo", warn.conflicts = FALSE, quietly = TRUE)
will load the package completely silently.
Now startupMessage()
for Package
acknowledges library(..., quietly = TRUE)
.
setConstructorS3()
no longer requires that
R.oo is attached (“loaded”).
getHowToCite()
for Package
utilizes
utils::citation()
, if package don’t contain a HOWTOCITE
file. It is recommended to write packages with CITATION instead of
HOWTOCITE.charToInt()
, intToChar()
,
hashCode()
, equals()
,
dimension()
, and trim()
.:::
.Made get-
and showHowToCite()
protected
methods.
Dropped deprecated inst/HOWTOSITE replaced by inst/CITATION.
Now it’s possible to call static methods without attaching
(“loading”) the package,
e.g. R.oo::Class$forName("Object")
. Added unit tests for
this.
Now getPackage()
for Class
first
searches the namespace of the Class
object and then the
attached (“loaded”) packages.
Now $
and $<-
for
Object
locates the static instance of the
Class
using getStaticInstance()
for
Object
.
Updated getStaticInstance()
for Object
to search more locations.
Now R.oo::ll()
works without attaching the package.
This is done by attaching R.oo when called.
Now it is possible to use static methods of a Class
without attaching the package where the Class
is defined,
e.g. R.utils::Arguments$getIndex(2)
. To enable this
feature, options("R.oo::Class/searchNamespaces"=TRUE)
must
be set.
ll(private = TRUE)
gave an error if the environment
contained the special ...
argument.@usage
.Now Rdoc$compile()
infer the package name from the
DESCRIPTION file (instead from the package directory name).
Added argument path
to
compileRdoc()
.
rm(x)
with
rm(list = "x")
.Rdoc$getUsage()
inserts line breaks so that any
usage line is at most 90 characters long.\usage{}
lines are at most 90
characters long.@RdocData
Rdoc tag also adds an
\docType{data}
Rd tag.@allmethods
not to be parsed and instead
treated as text.Now Rdoc$compile()
outputs the same Rd files
regardless of system settings. More precisely, it always uses
\n
for line breaks and locale “C” (default) for sorting
strings.
Now Rdoc$compile(..., filename)
handles when
argument filename
is a vector of filenames.
Rdoc$compile(..., check = TRUE)
saves the erroneous
Rd to file before throwing the exception. This helps
troubleshooting.Rdoc$compile()
could sometimes drop }
following Rdoc tags.Added support for Rdoc tag @author
to have an
optional value, e.g. @author "John Doe"
as well as
@author "JD, FB"
where the initials are inferred from the
package’s DESCRIPTION file.
Added compileRdoc()
to make it easier to compile
Rdoc comments into Rd help files,
e.g. Rscript -e "R.oo::compileRdoc()"
.
Now getAuthor()
and getMaintainer()
for
Package
use the Authors@R
field of DESCRIPTION
and if not found, then the Author
/Maintainer
fields. In addition, using argument as = "person"
will
parse and return the results as a person
list.
Authors@R
field to the DESCRIPTION.It is now easier to find help for static method,
e.g. help("Object$load")
and
?"Object$load"
.
For “static” methods (e.g. Object$load()
), the Rdoc
compiler now generates a \usage{}
section without the
deprecated Rd markup \synopsis{}
, which has been replaced
by the static call placed in a comment. It also uses the static method
as the name and alias (e.g. \name{Object$load}
).
Object
finalizers reentrant. This
was previously not the case on R prior to R v2.15.2 Patched r61487 iff
the garbage collection is triggered from within
base::parse()
and the R.oo package is not
already loaded when the finalizer is called. In such cases, R could
crash. Added a package system test for this. Thanks to Duncan Murdoch (R
core) for reporting on this and R core for making
base::library()
reentrant in R (>= 2.15.2 Patched
r61487).format
to
getInternalAddress()
for Object
.as.character()
for
Object
would contain the decimal value and not the
hexadecimal one.Further preparation for supporting R.oo and its derived packages to be imported without attaching (“loading”) them.
Replaced all data.class(obj)
with
class(obj)[1L]
.
getMethods()
for Class
would give an
error if no methods were found for the queried
Class
.
In the rare case where getStaticInstance()
for
Class
failed to setup a static instance, the temporary
state set internally would not be unset.
startupMessage()
for Package
.R CMD check
for R devel no longer gives a NOTE on
attach()
.getKnownSubclasses()
for Class
a bit
faster.Object
:s
(i.e. excluding those which are of a subclass of Object
)
will no longer be called if the R.oo package has been
detached. This should be a very unlikely scenario.extend()
for Object
dropped existing field
modifiers.getStaticInstance()
for Class
sets the
environment for the returned Object
to that of the
Class
.Object
/Class
in import-only namespaces,
i.e. without packages being loaded.RccViolationException$getRccUrl()
.obj$<method>(...)
would throw an error iff the
Object
obj
was saved or instantiated by
R.oo (< 1.10.0). Code is now backward compatible
with this case. Thanks Roger Day at University of Pittsburgh Cancer
Institute and Dan Tenenbaum (BioC core) for reporting on this....
to NextMethod()
,
cf. R-devel thread ‘Do *not* pass … to NextMethod()’ - it’ll do it for
you; missing documentation, a bug or just me?’ on Oct 16, 2012.GENERALIZATION: Now
<Class>$<staticFcn>(...)
calls the
corresponding generic function
<staticFcn>(static, ...)
, where static
is the static object of Class
<Class>
.
This allows for using NextMethod()
in static functions.
Calls to <Object>$<staticFcn>(...)
and
<BasicObject>$<staticFcn>(...)
were adjusted
analogously.
Now throw()
for Exception outputs the error message
both above and below the stack trace, which is particularly useful when
the stack trace is long.
Exception
dropped
the names of the functions.Exception
constructor could generate warning
In if (regexpr("^function \\(", code) != -1) return("") : the condition has length > 1 and only the first element will be used
occurring in its local fcnName()
function. Now code no
longer assumes that code
is of length 1.throw()
for Exception
aborts (after
signalling and outputting the message) by calling stop()
.
Ideally it should utilize abort()
, but the new version of
abort()
may be “caught” is certain cases.abort()
for condition
to utilize invokeRestart("abort")
. This avoids having to
call .Internal(.signalCondition(...))
. It also means that
the message outputted by abort()
no longer starts with a
“Error in …:” line. abort()
imitates how
stop()
works, but without the signalling.getContribUrl()
and getDevelUrl()
would
give an error if corresponding fields did not exists in the DESCRIPTION
file. Now they return NAs just as getUrl()
.GENERALIZATION: Added newInstance()
for
BasicObject
.
ROBUSTNESS: Now constructor BasicObject()
is
guaranteed to return an object with non-duplicated class attribute
elements.
getClass()
generic function,
which means that now there is one less function masking the
methods package.throw()
for Exception
would give an error
in R (< 2.14.0), where no generic getCall()
exists. Now
it works for all versions of R.Rdoc$getKeywords()
now uses system environment variable
R_DOC_DIR
for locating the internal KEYWORDS.db. Thanks
Charles Hogg at NIST for suggesting this.Added argument export
to
setConstructorS3()
.
Now Rdoc$getUsage()
searches also the package
namespace for the function/method definition. This is done, before
looking in the global search path.
setConstructorS3()
no longer sets attribute
formals
. It has been deprecated since April 2003.getCall()
from the
stats package so that generic function
getCall()
is available for Exception
:s also
when stats is not loaded, e.g. during executing
.Rprofile
.cleanup
of getStackTrace()
for
Exception
via an option.Made stack traces of Exception
:s more informative
and cleaner.
Now the default throw()
of
R.methodsS3 is “quietly” overwritten, i.e. there is no
longer a warning about it when R.oo is loaded.
Now package no longer warns about renaming existing functions
getMethods()
and getClasses()
of
base to default methods during installation, iff
R.methodsS3 (>= 1.2.3).
throw()
for error
is now just a
wrapper for stop()
. Previously it had to do what
stop()
now does for condition
objects.CRAN POLICY: Replaced all appendVarArgs()
for
base functions that do .Internal()
calls,
because they would then appear as local functions of this package and
hence not be accepted by CRAN according to their new policies. Instead
we now create “default” functions that are wrappers to the corresponding
functions in the base package. Extra care has to be
taken for functions that have arguments whose values are dependent on
the call environment/closure.
CRAN POLICY: Dropped .Internal()
calls in the
default ll()
method, in getMethods()
for
Class
objects, and in throw()
for
Exception
:s.
Now the package imports utils instead of depending on it. This means that all packages that depends on R.oo for loading utils for them need to explicitly load it themselves.
The R.oo package now requires (at least) R v2.4.0 (Oct 2006!)
package.description()
from
getDescriptionFile()
for Package
, which was
done for compatibility reasons when it was deprecated in R v1.9.0. It
will be dropped completely in R v2.15.0.help(setConstructorS3)
about the requirement that constructors defined by
setConstructorS3()
have to be callable without
arguments.getCall()
to x
,
because that is what the new getCall()
method of
stats in R v2.14.0 uses.ROBUSTNESS: Now finalizers for Object
:s are
registered to be called also when the R session is quit, if the
R.oo::Object/finalizeOnExit
option is TRUE. If FALSE
(default), as before, the finalizers were only executed when
Object
:s were cleaned up by the garbage collector.
Turned of the default instantiation timestamp for
Object
and BasicObject
. The main reason is
that it makes it very complicated to calculate reproducible checksums.
However, for backward compatibility, it is possible to turn on the
timestamp by setting option R.oo::Object/instantiationTime
.
For BasicObject
there is option
R.oo::BasicObject/instantiationTime
.
Added protected getFieldModifiers()
and
getFieldModifier()
.
Added argument recursive
to
clearCache()
for recursively traversing all elements are
clearing the cache of all detected Object
:s.
Now clearCache()
also calls
clearLookupCache()
.
Added protected clearLookupCache()
for clearing
internal objects stored in the Object
and that are used for
faster field lookups.
getInstanciationTime()
.inherits
(not inherit
) in all
calls to get()
and exists()
.##
) or
triple (###
) comment characters in addition to single
(#
) ones.addTimestamp
of
Rdoc$compile()
defaults to FALSE. This way the generate Rd
file will remain identical unless there are real Rdoc/code changes. Not
adding timestamps is better when working with a version control
systems.check()
of
Rdoc
would throw the error “object ‘res’ not found”.Package(pkg)
would throw “Error in Package(pkgname) :
object ‘package’ not found”, if pkg
is installed in
multiple libraries..conflicts.OK
after adding the
namespace.help(R.oo)
.isOlderThan()
for Package
.save()
of
Object
to leave an incomplete file due to say power
failures etc. This is done by first writing to a temporary file, which
is then renamed. If the temporary file already exists, an exception is
thrown.print()
statement in
attachLocally()
for Object
:s.objectSize()
for environments.Rdoc$compile()
did not work with R v2.10.0 and
newer.getBundle()
of Package
gave “Error in
getBundle.Package(pkg) : subscript out of bounds” starting with R
v2.10.0.Interface
class, which is in an alpha
version.registerFinalizer()
for
Object
.intToChar()
and charToInt()
where mixed up. Thanks to Jens Philip Hoehmann for reporting this.a %in% b
with is.element(a,b)
due to an old and weird bug that I cannot reproduce, cf. my R-devel post
in thread ‘Argument “nomatch” matched by multiple actual arguments …
%in% -> match?!?’ on March 6, 2008. Thanks Ran Pang for reminding me
and for additional troubleshooting.getInstantiationTime()
, but
keeping misspelled (and now deprecated)
getInstanciationTime()
for backward compatibility. The
internal attribute was also renamed, but the above method look for both
in case saved objects are loaded.Added getNews()
and showNews()
to the
Package
class. NEWS files are now detected
(first).
Added getConstructorS3()
.
The NEWS file does now replace the former HISTORY file of R.oo.
If running R v2.7.0 or new, the first element of vector
ASCII
is an empty string. This is because ASCII 0x00 cannot
be represented as an R string and in R v2.8.0 it will give a warning.
Note though that regardless of this,
charToInt(intToChar(0)) == 0
is still TRUE.
getName()
for environment
:s.getInternalAddress()
would return NA.citation("R.oo")
.a-Z
is illegal on (at least)
some locale, e.g. ‘C’ (where A-z
works). The only way to
specify the ASCII alphabet is to list all characters explicitly, which
we now do in all methods of the package. See the r-devel thread “invalid
regular expression ‘[a-Z]’” on 2008-03-05 for details.finalize()
more
error prone.setMethodS3()
and related methods from
R.oo and put them in a standalone
R.methodsS3 package. While doing this, the
enforceRCC
argument used by setMethodS3()
was
renamed to validators
which now takes an optional list of
functions. Any code using argument enforceRCC = FALSE
must
now use validators = NULL
.packageStartupMessage()
so that it can be suppressed.Removed showAndWait()
for simpleError
,
which displayed a TclTk dialog for a generic error. Never used. If
someone wants the code, please tell me and I’ll forward it.
Removed deprecated trycatch()
; use
tryCatch()
instead.
Removed patched for R v1.8.x and before: stop()
,
try()
.
Object
:s are garbage collected after
R.oo has been detached, the error ‘Error in function
(env) : could not find function “finalize”’ would be thrown, because the
registered finalizer hook tries to call the generic function
finalize()
in R.oo. We solve this by
trying to reload R.oo (and the unload it again).
Special care was taken so that Object
:s allocated by
R.oo itself won’t cause an endless loop.list
from all
substitute()
calls.getData()
because there
might be a name clash with the nlme package.error
instead of
ex
in the exception handling of update()
of
the Package
class.reportBug()
since it was never completed.Now ll()
uses objectSize()
instead of
object.size()
. It also returns the properties in its
“minimal” data type, e.g. the objectSize
column contains
integers (not characters as before). This makes it possible to utilize
subset()
on the ll()
output.
Added a default method for objectSize()
, which is
just a wrapper for object.size()
.
trycatch()
defunct, i.e. it gives an error
suggesting to use tryCatch()
instead.getMethods(..., private = FALSE)
for class
Class
would return private methods, and
private = TRUE
would remove them. It should be the other
way around.
getMethods()
for Class
would sometimes
give error message: “Error in result[[k]] : subscript out of bounds”.
This in turn would cause Rdoc to fail.
getInternalAddress()
coerced the address to an
integer, addresses about 2^32 bytes = 4 GiB got address NA. Now
getInternalAddress()
and the default
hashCode()
return a double.getClass()
for class
Object
but also BasicObject
. These were
deprecated on 2002-12-15.Object
class. Currently it is only the “cached” modifier
that is recognized. To specify that a field, say, foo
is
“cached”, list it as cached:foo
. Fields that are “cached”
will be assigned to NULL when clearCache()
of the object is
called. For convenience there is also a gc()
method for all
Object
:s. See ?gc.Object
for an example.update(R.oo)
would throw an error and the package was
detached.Added method getEnvironment()
to class
Object
, which will return the environment where the
Object
’s members are stored.
Now ll()
does not assign variables in the lookup
environment, which means it will work with sealed environments
too.
Added isBeingCreated()
to Class
in
order to check if the constructor was called to create the static
instance or just any instance.
Now the Rdoc tag @allmethods
takes an optional
argument specifying if private, protected or public methods should be
listed.
setClassS3()
, which has been deprecated since
2003(!).addTimestamp = TRUE
to
Rdoc$compile()
. This makes it possible to turn of the
timestamp, because timestamps makes diff, say the one in Subversion,
think there is a real different.Rdoc$compile()
did not write the name of the source
file in the header (anymore).
The code for automatic formatting of replacement methods generated an error.
\usage{}
format for these.properties
of ll()
is given
by the option R.oo::ll/properties
. If not set when the
package is loaded, it is set to a default value. See
help(ll)
for more details. This was suggested by Tim
Beissbarth, German Cancer Research Center.showHistory()
for the Package
class was
calling itself.
Compiling Rdoc comments with invalid keyword tags would generate an internal error. Same for invalid visibility tags etc.
@see
and @seemethod
tags.Added getChangeLog()
and
showChangeLog()
to the Package
class. The
get-
and showHistory()
, which are to be made
deprecated in the future, are now wrappers for these two
methods.
Added Rdoc tag @RdocPackage
to generate
<pkg>-package.Rd
files.
Now the Rdoc compiler makes sure that the generated Rd files all
starts with a letter or a digit. If not, it adds a default prefix
(currently 000
). If not, the new R v2.3.0
R CMD check
may complaint about missing objects.
Removed all usage of NULL environments since they are now deprecated in R v2.3.0.
Now ...
is added explicitly to
setMethodS3()
in all Rd examples.
Added validation of arguments in replacement functions.
Added RCC validation of arguments in “picky” methods,
e.g. $()
.
$<-
function goes through alternatives where to
save the new value, e.g. set<Name>()
,
<name>
field, static <name>
field
etc. When a “match” found and the value was assigned, it did not return
(except for the set<Name>()
match), but instead
continued search for the rest. One effect of this was that the new value
was always assign to the static field too. The fix make the code run
faster too. Thanks Edouard Duchesnay at Service Hospitalier Frédéric
Joliot, Commissariat à l’Energie Atomique, France for spotting
this.Added argument replaceNewline
to
getDescription()
of Package
.
Now as.character()
of Package
reports
the title, the license, and the description, but no longer if the
package is part of a bundle. The latter was too slow since it had to
scan all installed packages.
Now print()
of Class
passes
...
to getDetails()
, that is, now
print(Class, private = TRUE)
will work too.
Added attachLocally()
to the Object
class.
Added extend.default()
, which can be used to extend
any type of object.
Now pure Object
:s are also finalized. Before only
subclasses defined via
extend(<Object>, "<SubClass>", ...)
was
finalized. This was not a big deal, because the
finalize()
:er of the Object
class is empty
anyway.
Object
.Rdoc$compile()
sometimes generated the error
invalid regular expression '\name{[^\}]*}'
(forgot to
escape {
and }
). Fixed. Thanks Lorenz
Wernisch, School of Crystallography, University of London for reporting
this.
getDetails()
in Class
would list
private and protected methods as public.
Argument enforceRCC
of setMethodS3()
was not passed to setGenericS3()
.
Now the static load()
method in Object
asserts that the loaded Object
inherits from the class that
the static object, which is used to call load()
, is of.
Thus, Object$load(...)
will load all Object
:s,
whereas MyClass$load(...)
will only load objects inheriting
from MyClass
.
Now an @RdocMethod
tag will not add keyword
“internal” if the class starts with a lower case,
e.g. matrix
.
A @keyword foo
can now be removed with
@keyword -foo
. Order is irrelevant, since
@keyword
:s are added at the very end.
getDevelUrl()
to the Package
class.appendVarArgs
of setMethodS3()
is
now ignored if a replacement function (named nnn<-
) is
defined.setMethodS3(..., abstract = TRUE)
generated warnings of
type using .GlobalEnv instead of package:<pkg>
. Found
a way (ad hoc?) to get rid of them. See source code for details. This
should remove similar warnings from packages loading
R.oo.Package now outputs “See ?R.oo for help” when loaded.
setMethodS3(..., abstract = TRUE)
now defines
abstract methods with ...
as the only argument(s).
Now using three-digit version numbers, e.g. a.b.c where a,b,c in 0,1,…,9. ‘a’ is updated for major updates, ‘b’ for minor updates and ‘c’ is for minor revisions.
Removed require(methods)
for R v2.0.0 and
above.
Added appendVarArgs = TRUE
to
setMethodS3()
, which specifies that ...
should
be added, if missing.
Add argument ...
to all methods to make it even more
consistent with any generic function. This is also done for a few
methods in the R base packages.
R CMD check
on R v2.1.0 devel
without warnings.get-
& showDescription()
to
get-
& showDescriptionFile()
and added
getDescription()
to get the Description
field
of DESCRIPTION.setMethodS3()
that is not using
Object()
.R CMD check
on R v2.1.0 devel also.
Had to modify a few lines of code to meet the new stricter regular
expression patterns.trycatch()
in favor of
tryCatch()
. trycatch()
remains for a while,
but will be made deprecated in future version and later probably
defunct.By default, now Rdoc$compile()
runs
Rdoc$check()
at the end.
Rdoc: Added a first simple test for undefined top-level tags in
the generated Rd code. Utilizes tools::Rd_parse()
, which
might be renamed etc. according to its help page.
Tag-variables such as @author
now search for value
in options()
too.
getRdMethods()
in Class
returned empty
\tabular{rll}{}
if no methods exist, but this gives an
error in R CMD Rdconv
.When using setMethodS3(..., abstract = TRUE)
in a
package that uses lazy loading, which all new packages do by default,
warnings like “using .GlobalEnv instead of package:utils” will be
generated the first time the abstract method is accessed. This is
because eval()
is used to create the abstract method; we
are looking for a way that will not generate these warnings, although
they are not serious. Example:
library(R.colors); print(getColorSpace.Color)
.
Added getEnvironment()
to the Package
class.
unload()
for the
Package
class to load the boot package
instead of obsolete ts.Substantially improved the loading of all my packages. The
Package()
constructor, which was called when a new package
was loaded, was slow unnecessarily slow because of an internal call to
installed.packages()
.
Added known generic function as.vector()
.
getInternalAddress()
for class Object
was
“too” hard coded making it not work correctly on for instance Suse
Linux. Assumed fixed positions of the hexadecimal address of the
environment. Now a gsub()
with a backreference is used.
Should be more safe.package.description()
that occurred R v1.9.0 such that the code still works for older versions
of R. This was needed for the Package
class.Updated trycatch()
(and the Exception
class) to work with R v1.8.1. If running R v1.8.1, then
tryCatch()
is used internally. For R v1.7.1 and before the
old trycatch()
is used, which will be made deprecated later
on. Added a throw()
for the error class too for rethrowing
errors.
Update the Rdoc compiler to generate correct \name
and \alias
Rd tags.
setClassS3()
, please use
setConstructorS3()
instead; setClassS3()
is
deprecated and will be phased out soon!Package
class - from R v1.8.1 we noted that
R CMD check
made installed.packages()
return
multiple matches of the same package. This might have been a problem
before too, but R CMD check
never complained.showDescription()
, getHistory()
,
showHistory()
, getHowToCite()
, and
showHowToCite()
to the Package
class.\keyword{}
statement was placed
on the same line as the previous Rd statement. This sometimes generated
cluttered Rd index files.Package: update()
does now also reload the updated
package by default.
Exception: Now the throw()
method includes the
complete stacktrace too when generating a error signal. In other words,
the user will automatically see the stacktrace of the error if the error
is not caught. Same for stop()
.
Rdoc: Added the tag @RdocDocumentation
for general
documentation.
Added argument compress = TRUE
to
Object
’s save()
to make it more explicit that
compression is supported too. Compression is supported by all R systems
since R v1.5.0. See ?capabilities
.
Now Rdoc tries to create the ‘man/’ (destPath
)
directory if missing.
$<-.Class
was incorrectly returning the static
object instead of itself.
The way $.Object
, $<-.Object
,
$.Class
and $<-.Class
were checking if an
attribute exists was not done correctly. Now they get the list of names
of the attributes and compares to that.
If Object
’s save()
was called with a
connection it would still interpret it as a filename.
getMethods()
was not sensitive to
deprecated = TRUE
.dimension()
would not always be found if
ll()
was called on another package,
e.g. ll(envir = "methods")
.Added Rdoc comments saying that the constructor function must be able to be called without any arguments! Thanks Nathan Whitehouse at Baylor College of Medicine, Houston for making me aware of the missing documentation.
Rdoc$compile()
generated an
InternalException
when a class was not found saying “Not a
class”. Now it throws an RdocException
and is more specific
saying that the class does not exist. Updated the Rdoc comments saying
pointing out that the classes and methods have to be loaded before
calling Rdoc$compile()
. Again, thanks Nathan.
%
in \usage{}
in Rdoc,
which lead to unbalanced curly brackets when R CMD check
ran.get<Name>
and set<Name>
, which is
done by using substr()<-
.Now the Rdoc compiler generates the correct
\synopsis
and \usage
pairs. Before they were
added either or, but that was a mistake by me. \synopsis
should be added whenever the \usage
statement is
not complete.
update()
of Package
did not work. Did
by mistake add a package argument to update.packages()
too.
That argument is only used in install.packages()
though.
force = FALSE
to update()
in the Package
class.R.oo: The Rdoc compiler was further improved and made more flexible. I am aiming to make it possible for the user to define their own simple tags.
All Rd files are now making use of
\link[pkg:name]{label}
for referring to methods not named
according to the label. This is for instance the case with all class
specific methods. More over, all Rd files for classes has
\keyword{classes}
and the \usage{}
is used
where it works and otherwise \synopsis{}
is used (as
recommended on the R help pages). All this is automatically taken care
of by the Rdoc compiler.
Added getDocPath()
, update()
, and
unload()
to the Package
class. With
update()
it is now possible to update a package or its
bundle by just typing update(R.oo)
.
Added showAndAsk()
to the Exception
. It
will, if tcltk is installed, display a dialog box with
the error message. If tcltk is not installed, the
message will be printed on the command line and a prompt requesting the
user to press enter will be shown. showAndAsk()
will give
an error if run in a non-interactive mode.
Added almost all missing help pages, i.e. I wrote up a
lot of Rd files. More help is still though for the Rdoc class,
which compiles Rdoc comments in the source files into Rd files. However,
if you want to use Rdoc$compile()
already now, see the
source files for plenty of examples and just run
Rdoc$compile()
in the same directory.
Spell correction: “c.f.” -> “cf.”
getStaticInstance()
of class Class
did not
recover correctly if static instance was missing.Added getUrl()
, getMaintainer()
,
getAuthor()
, getTitle()
,
getLicense()
, and getBundle()
. Made the output
from as.character()
more informative.
Added a caching feature of $()
to speed up access to
members. The first time a member (field, virtual field, static field,
method etc) is accessed it is done by looking it up one at the time and
taking the first existing one (in a predefined order). The second time
the same field is accessed, the name is remembered and $()
access the right member directly. If this works out,
$<-()
will get a similar cache.
try()
, which a slight modification to the
base::try()
for improved exception handling, to have its
own internal restart()
function (just like
base::try()
), because restart()
has been made
deprecated from R v1.6.0. This is how the try()
in the base
package does it.Added the finalizer method finalize()
, which any
subclass can override and that will be called by the garbage collector
just before an object is about to be removed from the memory.
Added default function for equals().
Added argument overwrite = TRUE
and
conflict = c("error", "warning", "quiet")
to
setMethodS3()
.
Now extend()
in class Object
removes
duplicated class attributes.
Now it is possible to create methods (also generic) with one (or
several) .
(period) as a prefix of the name. Such a method
should be considered private in the same manner as fields with a period
are private.
Added argument path = NULL
to save()
and load()
in class Object
. It will remove the
need using paste()
etc.
For ll()
, replaced "getClass"
with
"data.class"
in the properties
argument. Since
data.class
is almost the same as mode
,
mode
was also removed.
SPELL CHECK: “…name name…” in one of
setGenericS3()
’s error messages. Thanks Gordon Smyth, WEHI,
Melbourne, for the comment.
COMPATIBILITY FIX: Removed default getClass()
,
because it was not would not work with the methods package.
Removed deprecated and obsolete
is.interface()
.
Rdoc
class listed too many methods in the “Methods
inherited” section.setClassS3()
to
setConstructorS3()
, since this is what it is actually
doing. Keeping setClassS3()
for backward compatibility but
made it deprecated.Updated setGenericS3()
to always create
generic functions with no arguments except ...
to follow
the RCC.
Now $()
and $<-()
in class
Object
and Class
also gets and sets attribute
values too, respectively.
Added getInstanciationTime()
, which returns the time
point when the object was created.
Updated getField()
of class Class
to
call generic method getField()
and not
getField.Object()
.
$<-()
of class Class
did not work
for static fields.
getDetails()
would not add a newline after the class
name if the class did not have a superclass, i.e. for root class
Object
.
Decided to declare all Rd files for class methods as
\keyword{internal}
which means that they will not show up
in the HTML table of contents. Only classes and stand-alone functions
should be there.
The package now contains the public classes Object
,
Exception
, RccViolationException
. It also
contains the internal classes Class
, Package
,
and Rdoc. The class Class
is essential, but
Package
and Rdoc
are just utility classes
containing useful static methods for development purposes etc.
The idea behind the Rx.oo package are the same as behind “old” R.oo, but internally environments are used for emulating references, whereas in R.oo a global so called object space was used. However, API-wise not much have been changed.
FYI: R.oo was first published in March 2001 and has undergone several updates, tests and bug fixes. Experience from that project has been brought into this package.
Added trial versions of extend()
of class
Object
and class Reference
. Also added trial
version of superMethodS3()
to replace faulty
NextMethod()
.
Added as.Reference()
to class Object
and class Reference
and made the constructor accept
Reference
objects by just returning them again. Before an
exception was thrown.
Added argument showDeprecated = FALSE
to
classinfo()
in class Class
. This has the
effected that when typing a name of a class and pressing enter at the
prompt to display class information, deprecated method are not
shown by default.
Added the class Class
for dealing with static
methods, static fields, accessing methods and fields of classes,
generating class information etc. Since the handling of static methods
and fields are now dealt by a specific class it means that the access of
non-static methods and fields, which is done by the Object
class, should now be a bit faster due to less overhead.
Internal updates: Made .ObjectSpace.count
an
internal variable of the .ObjectSpace
environment, meaning
that it is harder to delete it by mistake.
Added internal function
getPackagePosition()
.
relibrary(R.oo)
was reloading the
.RObjectSpace
file too, which is not a wanted
feature.
setGenericS3()
would sometimes believe that a
non-function object actually was a function and tried to set it as a
generic function, which resulted in an error exception.
createClassS3()
would throw an error exception if
there where two packages loaded such the name of the first one
was the same as the beginning of the name of the second one,
e.g. R.oo and *R.oo2.
Added the functions Q()
and Quit()
for
quitting with the option to save the ObjectSpace
also.
Added isGenericS3()
and
isGenericS4()
.
If trying to use delete()
to remove a non-existing
variable or Object
now only a warning is given, before an
exception was thrown which was quite annoying. delete()
works as rm()
plus it also deletes objects in
ObjectSpace
, which means that all calls to
rm()
can be replaced by calls to
delete()
.
Added the static methods ObjectSpace$save()
and
ObjectSpace$load()
to save and load an image of the
ObjectSpace
.
R CMD check
with 5 warnings.[[
in class Reference
did not work for
numeric indices, e.g. ref[[5]]
. Strange that I haven’t
noticed this before.$
and [[
also searches for fields in
attributes()
. This is a first step towards making use of
structure()
and friends instead. I’ve been thinking about
this from the very beginning, but newer done it. The plan is to move
away from the internal list()
and accept any R object as
the core object. This will also be more consistent with the R.methods/S4
strategy.setGenericS3()
.Moved about()
from R.base to this
package and removed old description()
.
Now the package reports its name, version and date if it was successfully loaded.
Minimized the number of warnings when loading packages.
Added argument dontWarn
to
setGenericS3()
, which by default is set so no warnings are
produced for renamed methods in the base
package.
Copied packagePaths()
from package
R.base to package R.oo, since it is
required in R.oo and we do not want
R.oo to depend on R.base.
R CMD check
with 5
warnings.The classes Throwable
and Exception
have been transferred to here from the R.lang package.
With the trycatch()
they are really useful.
throw()
and trycatch()
are now
available in both R.base and
R.oo.
Added createClassS3()
and internal variable
.NewClassesNotCreated
.
$.Object()
and $.Reference()
now
returns NULL if a field/method etc is not found! Before it an error was
thrown.
trycatch()
didn’t work methods created by
setMethodS3()
. This was due to I did (internally):
object <- try(eval(substitute(object, envir=envir)))
instead of:
object <- try(eval(substitute(object), envir=envir))
Hmm, a tricky typo to find since it worked elsewhere.
Tiny bug fix in message of throw()
clause in
$()
.
Added a trial version of [.Reference
. Currently, it
does not support the get<Field name>()
idea as
described below. Maybe a [<-.Reference
will be added
later.
Added trial version of a new feature for
Object
/Reference
fields. Now, if a field does
not exist and there is no method with the same name, then, if a method
named get<Field name>()
exists, the value of
get<Field name>(<object>)
is returned. This way
one can have fields that are generated “on the fly” to save memory etc.
This new feature required that [[.Object
was modified
(actually created). Example: For an object obj
one can get
its class by either the classical getClass(obj)
or by the
new feature obj$Class
. If this new feature are successful,
I will also look at implementing a corresponding
set<field name>()
support.
setGenericS3()
gave an error if one tried to set a
generic function with the same name as an R object that was not
a function. A simple add of argument mode = "function"
to
the exists()
check fixed this.clone()
in class Reference
did not work
properly; it gave the wrong internal reference names, which in turn
would generate errors such as ‘Error in get(x, envir, mode, inherits) :
variable “Reference.METHODS” was not found’ when one tried
object$foo()
instead of foo(object)
. Now it
works again.IMPROVEMENT: Since library(methods)
might be loaded
after library(R.oo)
the function extends()
breaks down. Worked this out a little bit by detaching and reloading
R.oo in function createClass()
if it is
detected that extends() has changed.
IMPROVEMENT: Forces
extends <- function(...) UseMethod("extends")
. The
reason for doing this is that if we have anything but ...
that argument might be matched by an attribute. Not good!
names()
to the class Reference
.When running the OO garbage collector, calling a
finalize()
that used the method super()
failed
with an exception. Internally, the class attributes of the freeable
references were lost.
extends()
and implements()
in
Rdoc
sometime gave errors.
attach()
and detach()
which works both on Object
’s and
Reference
’s.Renamed the (still) internal class .Reference
to
Reference
.
Added the setInterfaceS3()
method. Makes it easier
to define interfaces.
Static method buildClass()
in class
Rdoc
now also creates a list of methods and saves the
result in the file <class>.methods.Rdoc
, which can be
included in the Rdoc comments by
@include "<class>.methods.Rdoc"
. Hopefully, this will
mean that the list of methods in the help files will be more up to
date.
setClassS3()
, setInterfaceS3()
, and
setMethodS3()
.scanForMethods()
did not make a difference of
functions and non-functions, since it basically only looked at the name.
For instance would CONST.Foo <- 256
be considered a
method in previous versions. This was not a big deal, but it is correct
now.buildClass()
in class Rdoc
did not work
due to the new package methods. Corrected with one line
of code.trial
, deprecated
,
static
, protection
, and abstract
to setMethodS3()
(and to some extend also to
setClassS3()
).setClassS3()
and
setMethodS3()
internally.createGeneric()
to make life easier for class
developers.path = NULL
to
loadObject()
.obj$foo
is evaluated first the field
foo
is searched for and secondly the class method
foo()
is searched for. Previously, methods had higher
priority than fields.gco()
. R v1.4.0 made it crash.Internally renamed the methods, e.g. new()
,
getClass()
, and extends()
, that conflicted
with methods defined in the new R package methods.
Hopefully, these changes makes methods run when
R.classes is loaded.
Starting to separate Object
methods and
.Reference
methods. Eventually maybe R.oo
Object
’s could work very similar to
methods object where .Reference
is just an
add-on to make the Object
’s referensable.
First steps to make R.classes work together with the new methods package. These fixes made R.classes work when methods was loaded, but methods didn’t work when R.classes was loaded.
This version was never released to the public.
super()
, which provides a simple way to access
methods in the super class.Added support for this[[field]]
and
this[[field]] <- value
when this is a reference. Another
step away from get-
and putObject()
.
Introduced the modifers()
function instead of old
attr(...)
.
getObject()
and setObject()
much less of
interest and they will probably be made obsolete or private, which is
another step towards a more user friendly oo core.Improved the error and warning messages for false references.
delete()
can now remove any number of any kind of
objects, i.e. it is now more consistent to rm()
.
Created this HISTORY file. Everything below is recreated from from this date and is therefore not complete.
foo$value <- bar
, where foo
is either
the object itself or more common the reference to the object.Foo$myStaticMethod()
. For class developers: a
static class is created by new(Foo(), static = TRUE)
which
will not return a reference. A static class is only living on object
space.myStatic = METHOD+STATIC
and implemented as
myStatic.myClass <- function(arg1, arg2, ...)
. Note
that there is no this
argument to static classes.myFcn = function() NULL
and now one writes
myFcn = METHOD
where METHOD
is predefined
constant. This allows fields in a class to also contain functions,
i.e. myField = sqrt(x)
, which was not possible in previous
versions.