Picklegnome
2/22/2006 2:23:00 AM
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.
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"
<malteNOSPAM@gmx-topmail.de> 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
>