From ggrothendieck at gmail.com  Wed Jul 11 16:37:47 2007
From: ggrothendieck at gmail.com (Gabor Grothendieck)
Date: Wed, 11 Jul 2007 10:37:47 -0400
Subject: [Rd] Getting param names of primitives
In-Reply-To: <Pine.LNX.4.64.0707111513540.7025@gannet.stats.ox.ac.uk>
References: <d35b9da60707102141q60586e66w88a4b991595edcd0@mail.gmail.com>
	<Pine.LNX.4.64.0707110546480.27029@gannet.stats.ox.ac.uk>
	<18068.45289.14125.872148@stat.math.ethz.ch>
	<Pine.LNX.4.64.0707111314380.5891@gannet.stats.ox.ac.uk>
	<m2fy3v6ou0.fsf@ziti.fhcrc.org> <4694E4F8.3090000@stats.uwo.ca>
	<Pine.LNX.4.64.0707111513540.7025@gannet.stats.ox.ac.uk>
Message-ID: <971536df0707110737o6d5347b1i83366fb030c57fc2@mail.gmail.com>

These don't work either:

args(match.fun("{"))
args("{")



On 7/11/07, Prof Brian Ripley <ripley at stats.ox.ac.uk> wrote:
> On Wed, 11 Jul 2007, Duncan Murdoch wrote:
>
> > On 7/11/2007 9:40 AM, Seth Falcon wrote:
> >> Prof Brian Ripley <ripley at stats.ox.ac.uk> writes:
> >>
> >>> My problem is that if we make formals() work on primitives, people will
> >>> expect
> >>>
> >>> formals(log) <- value
> >>>
> >>> to work, and it cannot.
> >>
> >> But it could give an informative error message.  Asking for formals()
> >> seems to make sense so making it work seems like a good idea.  I'll
> >> agree that it working might encourage someone to try formals<-(), but
> >> the fact that it cannot do anything but error seems like a strange
> >> reason not to make formals() work.
> >
> > But primitives don't have formals, and that's why you can't set them. Having
> > formals(primitive) work just makes it harder to talk about the language.
> > Closures have formals, primitives don't.  Both have args.  If you want to
> > work with the args of a function, use the args.
>
> I agree: I was going to reply to Seth that the main reason was that
> 'formals() ought to refer to formals which primitives lack'.
>
> And note too that args(<primitive>) does not work for all primitives, as
> some are really part of the language (e.g. for(), return()).  Exactly
> which are is perhaps debatable, and the person who implemented the
> mechanism got to decide.
>
> --
> Brian D. Ripley,                  ripley at stats.ox.ac.uk
> Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
> University of Oxford,             Tel:  +44 1865 272861 (self)
> 1 South Parks Road,                     +44 1865 272866 (PA)
> Oxford OX1 3TG, UK                Fax:  +44 1865 272595
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>



[Rd] Getting param names of primitives
Gabor Grothendieck