[aklug] Re: Ruby code blocks

From: Michael Fowler <michael@shoebox.net>
Date: Sat May 29 2010 - 21:32:11 AKDT

On Sat, May 29, 2010 at 06:56:39PM -0800, barsalou wrote:
> I'm not sure of the use case for storing code in a hash, seems fraught =20
> with opportunity.

Storing references to code within a larger data structure is fairly
common; it's one means of implementing a fast switch statement, and is
called a dispatch table.

I don't know Ruby, but I expect in order to accomplish it you would use
the Proc module. Google should give good results on 'dispatch table'
and 'closure'.

--
Michael Fowler
www.shoebox.net
---------
To unsubscribe, send email to <aklug-request@aklug.org>
with 'unsubscribe' in the message body.
Received on Sat May 29 21:33:53 2010

This archive was generated by hypermail 2.1.8 : Sat May 29 2010 - 21:33:53 AKDT