Thursday, August 26, 2010

Learning += Fun;

I like the humor here ..

... if we want to hear the sound of a dog without getting emotionally attached, we can create (instantiate) an ephemeral, temporary dog, and coax a little noise out of it before it disappears.

prompt> (Dog.new).speak # or more commonly, Dog.new.speak
Bow Wow

"Wait," you say, "what's all this about the poor fellow disappearing afterwards?" It's true: if we don't bother to give it a name (as we did for pochi), automatic garbage collection decides it is an unwanted stray dog, and mercilessly disposes of it. Really it's okay, you know, because we can make all the dogs we want.

Seriously, I'd love to have dogs if the aforementioned operations were true in the real world.

No comments:

about me