From ggrothendieck at gmail.com  Tue Sep 26 23:18:50 2006
From: ggrothendieck at gmail.com (Gabor Grothendieck)
Date: Tue, 26 Sep 2006 17:18:50 -0400
Subject: [Rd] standardization of slot access
In-Reply-To: <87y7s6bbhq.fsf@patagonia.sebmags.homelinux.org>
References: <87y7s6bbhq.fsf@patagonia.sebmags.homelinux.org>
Message-ID: <971536df0609261418g1e2cf432yea64a0b539b2c6b9@mail.gmail.com>

I think the point is that if you use @ and then later redesign the
internals of the class so that that component is not longer stored
but is, instead, computed then @ will no longer be possible to
use in that instance and a method call will be required which means
that the internal change implies that the user interface must change.
Of course, that is undesirable.  In some programming languages
like Python one can access a variable and call a function using the
exact same syntax so that it would be possible to make such
an internal change without affecting the user.

On 9/26/06, Sebastian P. Luque <spluque at gmail.com> wrote:
> Hi,
>
> I'm usually confused about when to use 'slot' or '@'.  I've frequently
> read that it's always preferable to use accessor functions, so I would
> think the '@' operator should be avoided.  However, ?slot contains the
> following advise:
>
>
> "Generally, the only reason to use the functional form rather than the
> simpler operator is _because_ the slot name has to be computed."
>
>
> How do we decide whether to use the function or the operator?
>
>
> Cheers,
>
> --
> Seb
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>




[Rd] standardization of slot access
Gabor Grothendieck