Teach me about yield

Ok. I never did C, so I don’t know when you would use a function pointer.
I can relate to Pascal pointers and dynamic arrays, though…


“I must hurry back to my comic book store, where I dispense the insults
rather than absorb them.”


-----Original Message-----
From: Michael Campbell [mailto:michael_s_campbell@yahoo.com]
Sent: 23 September 2002 21:33
To: ruby-talk@ruby-lang.org
Subject: RE: Teach me about yield

I second that. 'plain please, Lucy!


I’m very new at this, but I look at using yield wherever in C I would
have used a function pointer.

As an example, c’s qsort(). You pass in the comparitor method there
(Java uses an interface for this). In ruby, your sort could take a
block instead.

(“sort” may not be a great example, as it’s built in a number of
useful places…)


Use your computer to help find a cure for cancer:

Yahoo IM: michael_s_campbell

Do you Yahoo!?
New DSL Internet Access from SBC & Yahoo!

NOTICE: This e-mail and any attachment(s) may contain confidential and
proprietary information of Goss International Corporation and/or its
subsidiaries and may be legally privileged. This e-mail is intended solely
for the addressee. If you are not the addressee, dissemination, copying or
other use of this e-mail or any of its content is strictly prohibited and
may be unlawful. If you are not the intended recipient please inform the
sender immediately and destroy the e-mail and any copies. All liability for
viruses is excluded to the fullest extent permitted by law. Any views
expressed in this message are those of the individual sender. No contract
may be construed by this e-mail.