On Tuesday 24 August 2004 10:25 am, Martin DeMello wrote:
> > my_obj.with (
> >   x: 0,
> >   y: 10
> >   width: 100
> >   height: 100
> > )
> >
> > Ruby2 ?
>
> This won't work for method calls, though, will it? 

The #with method would be defined to act just like the earlier given #set_all 
example (no instance_eval). That's all.

> What would be really 
> nice is
>
> my_obj.with {
>   .x = 1
>   .y = 2
>   .move_to(10,10)
>   .col = :RED
>   .repaint
> }

and

  ..class_method

instead of

  self.class.class_method

?

I agree that would be nice shorthand for self, if it could be done. Either 
that or perhaps:

  my_obj.with {
    @.x = 1
    @.y = 2
    @.move_to(10,10)
    @.col = :RED
    @.repaint
  }

so

  @. == self
  @@. == self.class

-- 
T.