From @purd|e@@ @end|ng |rom gm@||@com  Wed Mar 27 02:51:00 2019
From: @purd|e@@ @end|ng |rom gm@||@com (Abs Spurdle)
Date: Wed, 27 Mar 2019 14:51:00 +1300
Subject: [Rd] bugs in head() and tail()
In-Reply-To: <CAD4oTHFbbRs5GvhyR33+0mvXmsHFsBAK8hL_2CBDC_eeEA0e_w@mail.gmail.com>
References: <CAB8pepwajebtmzuGyMzd7ak_PhMakSwkXS-JEqV4VFW_2kh7sw@mail.gmail.com>
 <CAD4oTHFbbRs5GvhyR33+0mvXmsHFsBAK8hL_2CBDC_eeEA0e_w@mail.gmail.com>
Message-ID: <CAB8pepxwQmCbzeQZBuAiWxjSUxL_ZjOKEYozwi7WVY=Dd+kVwg@mail.gmail.com>

> so instead of hitting utils:::head.function, it hits
utils:::head.default, which uses [ on the argument, causing the error.

I've thought about this some more.
And I still think that this is a bug.

If a generic has a default method, then that default method should be
guaranteed to work.
Or at least, provide a useful error message, that makes it obvious to the
user, what he or she has done wrong.

In the case of head.default(), it assumes that the object is a vector, or
something similar.
This assumption is untrue.

>> Error in x[seq_len(n)] : object of type 'closure' is not subsettable

Resulting in the error above, which fails to recognize that the input was
unsuitable.

	[[alternative HTML version deleted]]



[Rd] bugs in head() and tail()
Abs Spurdle