Best explanation I have seen of indirection. 

Thanks,

thurman  

> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:hardhats-
> [EMAIL PROTECTED] On Behalf Of Gregory Woodhouse
> Sent: Wednesday, August 24, 2005 8:04 PM
> To: hardhats-members@lists.sourceforge.net
> Subject: Re: [Hardhats-members] All about programming
> 
> Well, indirection is not a concept unique to MUMPS. Do you recall
> that I said the symbol table associates a memory location with a
> variable. Well, that memory location is identified by a (typically
> large) integer. Indirection is the process of retrieving the value
> stored at that location. In C, if n is an integer variable, &n will
> be the location where it is stored, and if p is pointer to that
> memory location, *p is the value stored there. The * operation is
> called indirection. Another term you will often hear is dereferencing
> the pointer.
> 
> Now, MUMPS doesn't have pointers, but you can use a variable to store
> the name (or part of the name) of another variable, or even a
> command. As a simple case, try the following
> 
> SET X="HELLO"
> SET Y="X"
> WRITE @Y
> 
> The @ operator is the indirection operator in MUMPS. What this code
> does is lookup the value of Y to get "X" and then lookup the value of
> X to get "HELLO".
> 
> Indirection is a very powerful technique allowing you to implement
> things like callbacks (where you basically say to a function "execute
> this code if something special happens") and dynamic dispatch tables
> (where you basically create a table containing code that should be
> called in certain situations). It is a very powerful technique and
> especially useful when you're trying to design generic tools.
> 
> ===
> Gregory Woodhouse
> [EMAIL PROTECTED]
> 
> "Perfection is achieved, not when there is nothing more to add, but
> when there is nothing left to take away."
> -- Antoine de Saint-Exupery
> 
> On Aug 24, 2005, at 5:07 PM, Nancy Anthracite wrote:
> 
> > And to think I bothered to buy some books.  ;-)
> >
> > Please tell me about indirection.  That is the one thing I hear
> > newish MUMPS
> > programmers saying they want to know more about.
> 
> 
> 
> -------------------------------------------------------
> SF.Net email is Sponsored by the Better Software Conference & EXPO
> September 19-22, 2005 * San Francisco, CA * Development Lifecycle
> Practices
> Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
> Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
> _______________________________________________
> Hardhats-members mailing list
> Hardhats-members@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/hardhats-members



-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
Hardhats-members mailing list
Hardhats-members@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/hardhats-members

Reply via email to