From fparlamis at mac.com  Sat Sep 23 06:48:22 2006
From: fparlamis at mac.com (Parlamis Franklin)
Date: Fri, 22 Sep 2006 18:48:22 -1000
Subject: [Rd] generics for primitive functions
Message-ID: <6E529B79-B0D5-4F9B-AB5D-11D588D47D0A@mac.com>

i think these two code snippets exhibit a bug.  they are identical  
but for the inclusion of an initial line in snippet [2]

[1]
setMethod("Math", signature(x = "numeric"), function(x) "Works")
getGeneric("sqrt")(4)

[2]
getGeneric("sqrt")(4)
setMethod("Math", signature(x = "numeric"), function(x) "Works")
getGeneric("sqrt")(4)

these are my results, when each is run from a fresh R session

[1]
 > setMethod("Math", signature(x = "numeric"), function(x) "Works")
[1] "Math"
 > getGeneric("sqrt")(4)
[1] "Works"

[2]
 > getGeneric("sqrt")(4)
`__Deferred_Default_Marker__`
 > setMethod("Math", signature(x = "numeric"), function(x) "Works")
[1] "Math"
 > getGeneric("sqrt")(4)
`__Deferred_Default_Marker__`

the section in "How Methods Work" that deals with this is unfinished,  
but i think it suggests that getGeneric("sqrt")(4) should work out of  
the box.

franklin parlamis

 > version
                _
platform       powerpc-apple-darwin8.7.0
arch           powerpc
os             darwin8.7.0
system         powerpc, darwin8.7.0
status         beta
major          2
minor          4.0
year           2006
month          09
day            22
svn rev        39471
language       R
version.string R version 2.4.0 beta (2006-09-22 r39471)




[Rd] generics for primitive functions
Parlamis Franklin