From jmc at research.bell-labs.com  Mon Oct 13 23:52:05 2003
From: jmc at research.bell-labs.com (John Chambers)
Date: Mon Oct 13 23:51:19 2003
Subject: [Rd] Infinite recursion in getGeneric (PR#4561)
References: <80D701A2-FDBD-11D7-81E2-0003931A3C9E@stat.wisc.edu>
Message-ID: <3F8B1E85.3BDE1488@research.bell-labs.com>

Saikat DebRoy wrote:
> 
> On Monday, Oct 13, 2003, at 16:17 US/Eastern, John Chambers wrote:
> 
> > As a heuristic, setting methods for language-related primitives is
> > dangerous (also a little strange?).
> 
> Yes. But if it is allowed, someone will do it. It may actually make
> sense to come up with an appropriate (and preferably small) list of
> primitive functions and say that you can not define methods for them
> (at least easily).

If we're talking about r-devel, not r-patched, we can do better.  The
inherent problem is that a global table is used for dispatching methods
for primitives.  For 1.9, the plan is to replace this with more-or-less
real generic functions  (the less part is that the version of is.logical
the evaluator calls will still be a primitive; the generic will be found
by another mechanism).  Once methods are dispatched from valid generic
functions, then a call to is.logical within method dispatch will be
unaffected by methods defined for is.logical in another namespace.

As for r-patched, it would be easy to prohibit methods for those that
generate infinite loops, if we knew which ones they were.

John


[Rd] Infinite recursion in getGeneric (PR#4561)
John Chambers