From haverty.peter at gene.com  Fri Jan  9 19:56:44 2015
From: haverty.peter at gene.com (Peter Haverty)
Date: Fri, 9 Jan 2015 10:56:44 -0800
Subject: [Rd] RFC: getifexists() {was [Bug 16065] "exists" ...}
In-Reply-To: <21679.62919.821760.990215@stat.math.ethz.ch>
References: <bug-16065-16@http.bugs.r-project.org/bugzilla/>
	<bug-16065-16-N2rAUyzVWO@http.bugs.r-project.org/bugzilla/>
	<21678.19158.736089.111281@stat.math.ethz.ch>
	<54AE6C53.8030702@gmail.com>
	<OF12891DEC.6A4C5E3F-ON85257DC7.004D34A7-85257DC7.004D34AB@american.edu>
	<CAOQ5Nyev+TiYXpsQwmMqYkigucc8UZ9=fHFS-H+r=Kixs=5_xg@mail.gmail.com>
	<alpine.DEB.2.02.1501081340590.24557@luke-Latitude>
	<CAOQ5NyfpRJGixySbgrJXKdkPfawJFUhAiDHKh4dVcg5HUOX3sQ@mail.gmail.com>
	<21679.53494.724909.346806@stat.math.ethz.ch>
	<21679.62919.821760.990215@stat.math.ethz.ch>
Message-ID: <CAGh0NYoCsVfzZrhRej7FZa28qdcPRdUpuhuFHB1dF2uyXbudEg@mail.gmail.com>

Fantastic. I'm eager to try it out.  Thanks for seeing this through.

Regards,

Pete

____________________
Peter M. Haverty, Ph.D.
Genentech, Inc.
phaverty at gene.com

On Fri, Jan 9, 2015 at 7:37 AM, Martin Maechler <maechler at stat.math.ethz.ch>
wrote:

> >>>>> Martin Maechler <maechler at stat.math.ethz.ch>
> >>>>>     on Fri, 9 Jan 2015 14:00:38 +0100 writes:
>
> >>>>> Michael Lawrence <lawrence.michael at gene.com>
> >>>>>     on Thu, 8 Jan 2015 14:02:26 -0800 writes:
>
>     >> On Thu, Jan 8, 2015 at 11:57 AM, <luke-tierney at uiowa.edu> wrote:
>     >>> On Thu, 8 Jan 2015, Michael Lawrence wrote:
>     >>>
>     >>> If we do add an argument to get(), then it should be named
> consistently
>     >>>> with the ifnotfound argument of mget().
>
> You are right... I forgot to say so earlier in the thread.
>
> The definition now is
>
> get0 <- function (x, envir = pos.to.env(-1L), mode = "any", inherits =
> TRUE,
>                   ifnotfound = NULL)
>     .Internal(get0(x, envir, mode, inherits, ifnotfound))
>
>
>
>     >>>> As mentioned, the possibility of a
>     >>>> NULL value is problematic. One solution is a sentinel value that
> indicates
>     >>>> an unbound value (like R_UnboundValue).
>     >>>>
>     >>>
>     >>> A null default is fine -- it's a default; if it isn't right for a
>     >>> particular case you can provide something else.
>     >>>
>
>     [..................]
>
>     >>> Adding getIfExists, or .get, or get0, or whatever seems fine.
> Adding
>     >>> an argument to get() with missing giving current behavior may be OK
>     >>> too. Rewriting exists and get as .Primitives may be sufficient
> though.
>
>     > Thank you, Luke.  Given that, Duncan's and the other inputs,
>     > I think we should go for a new function -- .Internal() for now.
>
>     > To Pete's point about arguments, I did drop 'frame' on purpose
>     > and indeed we could try to do away with 'where/pos' as well and
>     > have the environment only specified by 'envir'.
>
>     > Name: I like  get0() for its brevity and prefer it to .get().
>
>     > Let me expose my current implementation on R-devel ... and start
>     > using it in the 'methods' package so we (Pete H. :-) can start
>     > measuring its impact.
>
> I have now committed  get0() to R-devel  (svn rev 67386)
>
> which is already using it in quite a few places:
> in 'base', notably in base/R/namespace.R   where it may speedup, also
> in 'methods' in quite a few places also in the hope of some S4
> speedup.
>
> {{Now I feel having deserved some weekend break ...}}
>
> Martin
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>

	[[alternative HTML version deleted]]



[Rd] RFC: getifexists() {was [Bug 16065] "exists" ...}
Peter Haverty