Displaying 10 results from an estimated 10 matches for "checkconflicts".
2016 May 20
2
identical on closures
I'm confused by this:
> identical(function() {}, function() {})
[1] FALSE
Yet, after loading the Matrix package (which redefines det), the
following is checked (in library.checkConflicts):
> identical(get("det", baseenv()), get("det", asNamespace("Matrix")),
ignore.environment=T)
[1] TRUE
I've looked at the code in identical.c and for closures it seems to
compare the FORMALS and the BODY_EXPR, so why does the first example not
return TRUE...
2014 Apr 07
1
attach() outputs messages to stdout - should it be stderr?
...tach() output messages to
stdout instead of stdout, e.g.
> a <- 1
> capture.output(attach(list(a=1)))
[1] "The following object is masked _by_ .GlobalEnv:"
[2] ""
[3] " a"
Shouldn't this message go to stderr?
Here's a patch for the local function checkConflicts() of
base::attach(), cf. ditto for base::library() that outputs to stderr:
Index: library/base/R/attach.R
===================================================================
--- library/base/R/attach.R (revision 65344)
+++ library/base/R/attach.R (working copy)
@@ -73,7 +73,7 @@...
2015 Oct 12
2
identical(..., ignore.environment=TRUE)
...e formals, the body and the environment.
(Actually, 4 parts: like almost all R objects, they may also have
attributes.)
That arg just says to ignore the environment part when comparing
closures. It doesn't say to ignore environments in general.
>
> In the R code base it's used in checkConflicts (to see if a function
> is re-exported) and in getAnywhere ...
>
I'd say those uses are slightly bogus. You should generally remember
that closures have 3 (or 4) parts, and not go around comparing only two
(or 3) of them.
Duncan Murdoch
2015 Oct 12
2
identical(..., ignore.environment=TRUE)
On 11/10/2015 10:36 PM, Duncan Murdoch wrote:
> On 11/10/2015 8:05 PM, Ben Bolker wrote:
>>
>> It seems odd/inconvenient to me that the "ignore.environment" argument
>> of identical() only applies to closures (which I read as 'functions' --
>> someone can enlighten me about the technical differences between
>> functions and closures if they like
2015 Oct 13
1
identical(..., ignore.environment=TRUE)
...ven though it ends up using string comparison after deparse(.)
> .. about which one can debate... but I don't think we'd want to
> change all.equal.language() at this point in time].
>
> Martin
>
>
> >>
> >> In the R code base it's used in checkConflicts (to see if
> >> a function is re-exported) and in getAnywhere ...
> >>
>
> > I'd say those uses are slightly bogus. You should
> > generally remember that closures have 3 (or 4) parts, and
> > not go around comparing only two (or 3) of...
2015 Oct 12
0
identical(..., ignore.environment=TRUE)
...environments are not ignored recursively (that's
not exactly what I mean -- I mean ignoring all environments of components
of an object), I have trouble understanding the use case for
ignore.environnment ... maybe it was developed before srcrefs
existed?
In the R code base it's used in checkConflicts (to see if a function
is re-exported) and in getAnywhere ...
2010 Mar 17
1
Suggestion: Not having to export .conflicts.OK in name spaces
...atchOn() || checkNoGenerics(env, package
)
if(warn.conflicts &&
- !exists(".conflicts.OK", envir = env, inherits = FALSE))
+ !exists(".conflicts.OK", envir = ns, inherits = FALSE))
checkConflicts(package, pkgname, pkgpath,
nogenerics, ns)
runUserHook(package, pkgpath)
In order to be consistent, a patch for attach() should also be
provided, which requires some more changes, but I won't spend time on
that unless the above is a...
2012 Mar 09
0
.conflicts.OK no longer working regardless of export(.conflicts.OK) due to "stoplist"
...export '.conflicts.OK' in the namespace,
otherwise it would not be found in the internal conflict test of
library(), cf. print(base::library):
...
if(warn.conflicts &&
!exists(".conflicts.OK", envir = env, inherits = FALSE))
checkConflicts(package, pkgname, pkgpath,
nogenerics, ns)
...
By replacing envir=env with envir=ns, it will be found. Here is what
I get if I use debug(library):
Browse[2]> exists(".conflicts.OK", envir=env, inherits=FALSE)
[1] FALSE
Browse[2]> exists(&quo...
2015 Oct 13
0
identical(..., ignore.environment=TRUE)
...nk should really do what you want
[even though it ends up using string comparison after deparse(.)
.. about which one can debate... but I don't think we'd want to
change all.equal.language() at this point in time].
Martin
>>
>> In the R code base it's used in checkConflicts (to see if
>> a function is re-exported) and in getAnywhere ...
>>
> I'd say those uses are slightly bogus. You should
> generally remember that closures have 3 (or 4) parts, and
> not go around comparing only two (or 3) of them.
> Duncan Murd...
2016 May 20
2
identical on closures
...wrote:
> On 5/20/16 12:40 PM, Mick Jordan wrote:
>
>> I'm confused by this:
>>
>> > identical(function() {}, function() {})
>> [1] FALSE
>>
>> Yet, after loading the Matrix package (which redefines det), the
>> following is checked (in library.checkConflicts):
>>
>> > identical(get("det", baseenv()), get("det", asNamespace("Matrix")),
>> ignore.environment=T)
>> [1] TRUE
>>
>> I've looked at the code in identical.c and for closures it seems to
>> compare the FORMALS and the...