On Nov 12, 4:06 pm, Robert Dober <robert.do... / gmail.com> wrote:
> On Nov 12, 2007 8:10 PM,  <furtive.cl... / gmail.com> wrote:
>
> > This is the first I've heard of Object#tap.  It seems backward because
> > you almost always want the result of the block, not the object back
> > again.  All of my ruby scripts use
>
> >    class Object
> >       def as
> >          yield self
> >       end
> >    end
>
> I am so glad, I really needed Object#itself in Labrador, somehow I
> felt alone with this approach, now it seems i am not that weird after
> all.
>
> I however adhere with Ara's POV, what is there that instance_eval
> cannot give you?

Well, I don't want a block which is evaluated in the instance's
context.  Why would I even risk doing that?  What if I want to use the
"self" before the instance_eval?  What if I use "self" inside the
block while forgetting that I'm inside an instance_eval?  I'd be
screwed for no reason.

The use instance_eval communicates a specific purpose which entirely
different from the purpose of Object#as.  I want to take the current
object, name it *as* something, perform some operations on it, and
give the result.

The current object should not be given the name "self", which is a
special name.  It should be given a temporary name (e.g. "t") which
communicates its temporal non-specialness.  Object#instance_eval is
the former, Object#as is the latter.