On Aug 18, 2005, at 10:36 AM, Eric Mahurin wrote:

>> Perhaps you want to create and use an object without even
>> assigning it to a variable:
>>
>> Message do |mes|
>>      # build message here...
>>
>>      mes.send
>> end
>>
>
> You missed a .new, I believe.

Oops, right you are.

> I'd still say my Object#post (someone else called it "then")
> would be a better thing to have instead of every initialize
> doing "yield self if block_given?" at the end.  If there was
> something done after the yield (like checking or even
> closing/destroying the object), then there'd be more use.
>
> class Object
>   def post
>     yield(self)
>     self
>   end
> end
>
> Message.new.post do |mes|
>      # build message here...
>      mes.send
> end

Hmm, I don't like that because it moves the management responsibility  
down to the caller, for no gain that I can see.  But, of course, we  
are both free to create them however we like.  ;)

James Edward Gray II