From murdoch at stats.uwo.ca  Mon Nov  5 14:36:53 2007
From: murdoch at stats.uwo.ca (Duncan Murdoch)
Date: Mon, 05 Nov 2007 08:36:53 -0500
Subject: [Rd] namespace crash on S3method("as.ff",function)
In-Reply-To: <20071105124150.36550@gmx.net>
References: <20071105124150.36550@gmx.net>
Message-ID: <472F1C75.3010409@stats.uwo.ca>

On 11/5/2007 7:41 AM, Jens Oehlschl?gel wrote:
> Dear all,
> 
> I have defined a generic as.ff(x, ...) and a method as.ff.function(x, ...) which converts a standard R function x into a chunked version operating on large ff objects. Everything works fine, but when registering 
> 
> S3method("as.ff",function)
> 
> in NAMESPACE, the installation fails with some kind of parsing error:
> 
>   adding build stamp to DESCRIPTION
>   installing NAMESPACE file and metadata
> Fehler in parse(nsFile) : Unerwartetes ')' bei
> 348:
> 349: S3method("as.ff",function)
> Calls: <Anonymous> -> parseNamespaceFile -> parse
> Ausf?hrung angehalten
> make[2]: *** [nmspace] Error 1
> make[1]: *** [all] Error 2
> make: *** [pkg-ff] Error 2
> *** Installation of ff failed ***
> 
> Is this a bug? Any ideas?

"function" is a reserved keyword for the parser.  Even though you don't 
execute a NAMESPACE file, it's parsed by the standard parser, and that's 
causing the problem.  (You couldn't have a function call that looked 
like that without a parse error, either.)

I don't have time to explore this today, but what I'd do is try

S3method("as.ff", `function`)

or

S3method("as.ff","function")

first, and if those don't fix it and you don't get a better suggestion, 
then report this as a design bug.

Duncan Murdoch

> Best regards
> 
> 
> Jens
> 
> 
> P.S. with as.ff() we can do things like
> ffx <- as.ff(x) # as.ff.default() turns a standard R object into an ff object stored on disk
> as.ff(log)(ffx) # as.ff.function() turns 'log' into a function that we can call on ffx: taking the log of an almost arbitrarily large object
> 
> 
>> version
>                _                           
> platform       i386-pc-mingw32             
> arch           i386                        
> os             mingw32                     
> system         i386, mingw32               
> status                                     
> major          2                           
> minor          6.0                         
> year           2007                        
> month          10                          
> day            03                          
> svn rev        43063                       
> language       R                           
> version.string R version 2.6.0 (2007-10-03)
>



[Rd] namespace crash on S3method("as.ff",function)
Duncan Murdoch