From l@wrence@mich@el @ending from gene@com  Thu Aug  9 23:59:26 2018
From: l@wrence@mich@el @ending from gene@com (Michael Lawrence)
Date: Thu, 9 Aug 2018 14:59:26 -0700
Subject: [Rd] WishList: Remove Generic Arguments
In-Reply-To: <CAB8pepwoUPZRQ8V_OCaZq=QdM3fRbT4zYa8OjOgZvKucmSVFQA@mail.gmail.com>
References: <CAB8pepwoUPZRQ8V_OCaZq=QdM3fRbT4zYa8OjOgZvKucmSVFQA@mail.gmail.com>
Message-ID: <CAOQ5NycQZBoJvDbJcPoSje9f-n+Vvp7g85ddBn5MwYYpfuiLsg@mail.gmail.com>

A generic function is not simply a way to name two functions (methods)
the same. It has a particular purpose, and the argument names are
aligned with and convey that purpose. The methods only implement
polymorphism; they don't change the purpose. Changing the purpose
would make code unreadable.

Michael

On Thu, Aug 9, 2018 at 2:45 PM, Abs Spurdle <spurdle.a at gmail.com> wrote:
>  I apologize if this issue has been raised before.
>
> I really like object oriented S3 programming.
> However, there's one feature of object oriented S3 programming that I don't
> like.
> Generic functions can have arguments other than dots.
>
> Lets say you have an R package with something like:
>
> print.myfunction (f, ...)
> {   dosomething (f, ...)
> }
>
> Noting that I use function objects a lot.
>
> R CMD check will generate a warning because you've named your object f
> rather than x.
>
> I don't want to name my object x.
> I want to name my object f.
> Naming the object x makes the program unreadable.
> Especially if f contains an attribute or an argument named x.
>
> There's a work around.
> You can redefine the print function, using something like:
>
> print = function (...) base::print (...)
>
> However, you have to export and document the function.
>
> I think that it would be better if generic functions didn't have any
> arguments except for dots.
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>



[Rd] WishList: Remove Generic Arguments
Michael Lawrence