"Saikat" == Saikat DebRoy <[EMAIL PROTECTED]> on Thu, 9 Oct 2003 11:41:01 -0400 writes:
Saikat> This is most problematic when you are creating a Saikat> generic for an existing function in base (as you Saikat> very well could for log). This often makes the Saikat> ability to make new generics out of existing Saikat> functions somewhat useless.
Assuming you're right, I'm much less sure that this consequence has been intended in all situations. But I'd need to see concrete examples to understand your last sentence.
Here is an example of what I was saying.
> setClass('foo', representation(x='numeric'))
[1] "foo"
> setMethod('log', signature(x='foo', base="missing"),
+ function(x, base) callGeneric([EMAIL PROTECTED]))
[1] "log"
> setMethod('log', 'foo', function(x, base)
+ callGeneric([EMAIL PROTECTED], base))
[1] "log"
> log(new('foo', x=100))
[1] 4.60517
> log10(new('foo', x=100))
Error in log(x, base) : Non-numeric argument to mathematical function
>This means that if I create a generic for 'log', I should also create a generic for each function in base that makes a call to 'log'. That is not what I expected.
______________________________________________ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-devel
