From: Bill Guindon Date: 2006-02-22T12:00:21+09:00 Subject: Re: Blocks / Closures On 2/21/06, Picklegnome wrote: > Thanks for all your help! > > As for my real name, I must apologize. I know it's bad etiquette, but I am > required to wait for a few more years (at least until I'm out of the house, > if not 18) by my parents. I personally don't see a problem with it, but I > don't feel it's inappropriate for them to ask that of me. Again, my > apologies. You are wise beyond your years (and so are your parents). Of course, I had a small hope that you'd reply with "What do you mean real name? Picklegnome IS my real name." But that would either mean you're about 20 years older, or you're a child of a movie star. ;) > Once more, thank you all for your recommendations and examples. They're > quite helpful! > > Picklegnome > > > > On 2/21/06 9:59 AM, in article > pan.2006.02.21.16.59.45.666422@gmx-topmail.de, "Malte Milatz" > wrote: > > > Picklegnome wrote: > >> Can blocks be used for non-iterative functions? > > > > For example, Hash.new can be given a block in which you provide a default > > value. Assuming that there is a class called Something: > > > > h = Hash.new { Something.new } > > a, b, c = h[0], h[0], h[1] > > > > a, b and c will contain three non-equal instances of Something, because > > every time h#[] is called, the block will be called. > > > > Any chance that we see your real name? > > > > Malte > > > > > -- Bill Guindon (aka aGorilla) The best answer to most questions is "it depends".