From: John Wilger Date: 2006-10-28T07:06:46+09:00 Subject: Re: can there be a "with" construction? On 10/27/06, John Wilger wrote: > On 10/27/06, matt neuburg wrote: > > Some languages have a "with" construction, where undefined methods are > > routed to a designated object. Here's an example from UserTalk: > > > > with system.startup { > > string(license) > > } ... > Off the top of my head, you could do: ... > There's definitely some nastiness there with the global variable, and > I'm sure someone is going to point out where this completely falls > apart within minutes of me posting it -- but it works for simple > cases, at least. OK, it was bothering me enough that I went ahead and fleshed out a better solution (complete with tests!) -- http://johnwilger.com/articles/2006/10/27/adding-with-to-ruby -- Regards, John Wilger http://johnwilger.com ----------- Alice came to a fork in the road. "Which road do I take?" she asked. "Where do you want to go?" responded the Cheshire cat. "I don't know," Alice answered. "Then," said the cat, "it doesn't matter." - Lewis Carrol, Alice in Wonderland