[Rd] invalid body argument for function

Duncan Murdoch murdoch.duncan at gmail.com
Thu Jun 30 18:35:46 CEST 2011


On 29/06/2011 9:09 PM, Michael Lawrence wrote:
> Hi guys,
>
> Looks like mkCLOSXP cannot handle external pointers as the function body.
> Work around is obvious, but I guess it's a bug nonetheless.

I don't know if it's a bug.  The mkCLOSXP code has a list of types that 
it accepts; external pointers and environments aren't in that list, so 
you get the same error you saw with

fun<- eval(substitute(function() x, list(x = environment())))

There's a comment

/* This is called by function() {}, where an invalid
    body should be impossible. When called from
    other places (eg do_asfunction) they
    should do this checking in advance */


I don't know whether there's any reason for the restriction, but I'd 
want to look closely at what gets done with the body to make sure that 
putting an environment or external pointer or other weird type there 
doesn't cause other problems.

Duncan Murdoch

> >  library(RGtk2)
> >  fun<- eval(substitute(function() x, list(x = gtkWindow())))
> Error in eval(expr, envir, enclos) : invalid body argument for "function"
> Should NEVER happen; please bug.report() [mkCLOSXP]
>
> >  sessionInfo()
> R version 2.14.0 Under development (unstable) (--)
> Platform: i686-pc-linux-gnu (32-bit)
>
> locale:
> [1] C
>
> attached base packages:
> [1] stats     graphics  grDevices utils     datasets  methods   base
>
> other attached packages:
> [1] RGtk2_2.20.13 qtbase_0.8-16 visnab_0.0.1
>
> loaded via a namespace (and not attached):
>   [1] BSgenome_1.21.3       Biobase_2.11.10       Biostrings_2.21.6
>   [4] DBI_0.2-5             GenomicFeatures_1.5.5 GenomicRanges_1.3.39
>   [7] IRanges_1.11.11       MutableRanges_0.2.0   RColorBrewer_1.0-2
> [10] RCurl_1.5-0           RSQLite_0.9-4         Rsamtools_1.5.13
> [13] XML_3.2-0             biomaRt_2.7.2         colorspace_1.0-1
> [16] dichromat_1.2-3       munsell_0.2           objectSignals_0.5.1
> [19] plumbr_0.6.2          plyr_1.4.1            qtpaint_0.7.22
> [22] rtracklayer_1.13.3    scales_0.1.0          stringr_0.4
>
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel



More information about the R-devel mailing list