On 8/28/05, Jeff Wood <jeff.darklight / gmail.com> wrote:
> Douglas Livingstone wrote:
> 
> >On 8/29/05, Jeff Wood <jeff.darklight / gmail.com> wrote:
> >
> >
> >>It breaks encapsulation for anything to call a private method other than
> >>the object itself... So, I guess it needs to have scope...
> >>
> >>
> >>
> >
> >We have open classes remember :)
> >
> >It isn't so much a problem that send/send! can break encapsulation,
> >rather it is "when you want to break encapsulation, how do you want to
> >do it?"
> >
> >Douglas
> >
> >
> >
> >
> Yes but adding/taking away from an object doesn't change it's
> interaction with the world...
> 
> The engine of a car can be added to and taken away from ... it's an
> instance ... but, that doesn't give the gas pedal control over the
> radiator...
> 
> Encapsulation should be enforced... My vote is solidly against adding
> anything that allows something outside of an object to have access to
> that objects internal bits... bad juju.

It is already possible; in fact, it's bordering on routine. There are
methods built in to Ruby especially for this kind of stuff - instance
eval, __send__, instance_variable_[gs]et, etc... Encapsulation in Ruby
does not create rules, it creates strong suggestions.

"Don't jump that fence, now! You might get hurt!"

cheers,
Mark