From mtmorgan at fhcrc.org  Wed Sep  5 22:50:19 2012
From: mtmorgan at fhcrc.org (Martin Morgan)
Date: Wed, 05 Sep 2012 13:50:19 -0700
Subject: [Rd] all.equal on external pointers and environments
Message-ID: <5047BB0B.60906@fhcrc.org>

For an external pointer

 > xp
<pointer: (nil)>

one might expect all.equal to behave as for environments

 > e = new.env()
 > all.equal(e, e)
[1] TRUE

but it does not

 > all.equal(xp, xp)
Error in unclass(target) : cannot unclass an external pointer

A solution is to dispatch to all.equal.language (?) in

src/library/base/R/all.equal.R:26

but this requires an is.expternalptr primitive.

In some respects, one might expect all.equal for environments to be more 
thorough

   e = new.env(); e[["a"]] = 1
   all.equal(e, new.env())          ## expect FALSE, as in next line
   all.equal(as.list(e), as.list(new.env()))
   all.equal(new.env(), new.env())  ## TRUE; ok?

Martin
-- 
Computational Biology / Fred Hutchinson Cancer Research Center
1100 Fairview Ave. N.
PO Box 19024 Seattle, WA 98109

Location: Arnold Building M1 B861
Phone: (206) 667-2793



[Rd] all.equal on external pointers and environments
Martin Morgan