From ruipb@rr@d@@ @ending from @@po@pt  Sat Oct  6 19:47:07 2018
From: ruipb@rr@d@@ @ending from @@po@pt (Rui Barradas)
Date: Sat, 6 Oct 2018 18:47:07 +0100
Subject: [Rd] Warning when calling formals() for `[`.
In-Reply-To: <f5d15068-0776-2b5e-11d7-b1ae6ffc1d3b@sapo.pt>
References: <CA+JCgN254QaHVepo03ZuGLsatwmjfDSnUP3yq43N6TguBdWN5g@mail.gmail.com>
 <f5d15068-0776-2b5e-11d7-b1ae6ffc1d3b@sapo.pt>
Message-ID: <85d9fe59-1f95-f55a-7dd2-a7dc6fa18e67@sapo.pt>

Hello,

I forgot to ask you to also try to break the `sum` instruction into its 
components:

args(`sum`)


does return a function. Therefore formals(args(`sum`)) returns something 
useable and no warning.

Rui Barradas

?s 18:42 de 06/10/2018, Rui Barradas escreveu:
> Hello,
> 
> I believe that this is maybe not a *feature* but at least expected 
> behaviour.
> 
> The call formals(args(`[`)) breaks down to
> 
> 
>  > args(`[`)
> NULL
>  > formals(NULL)
> NULL
> Warning message:
> In formals(fun) : argument is not a function
> 
> 
> Hope this helps,
> 
> Rui Barradas
> 
> 
> ?s 18:26 de 06/10/2018, Laurent Gautier escreveu:
>> Hi,
>>
>> A short code example showing the warning might the only thing needed 
>> here:
>>
>> ```
>>> formals(args(`[`))
>> NULL
>>
>> *Warning message:In formals(fun) : argument is not a function*
>>> is.function(`[`)
>> [1] TRUE
>>> is.primitive(`[`)
>> [1] TRUE
>> ```
>>
>> Now with an other primitive:
>>
>> ```
>>> formals(args(`sum`))
>> $...
>>
>>
>> $na.rm
>> [1] FALSE
>>
>>> is.function(`sum`)
>> [1] TRUE
>>> is.primitive(`sum`)
>> [1] TRUE
>>> class(`[`)
>> [1] "function"
>> ```
>>
>> Is this a feature ?
>>
>>
>> Laurent
>>
>> ????[[alternative HTML version deleted]]
>>
>> ______________________________________________
>> R-devel at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-devel
>>
> 
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel



[Rd] Warning when calling formals() for `[`.
Rui Barradas