RE: Declaring a Function Before it is used
- Posted by Matt Lewis <matthewwalkerlewis at yahoo.com> Nov 01, 2003
- 545 views
David Cuny wrote: > > > Phil Russel wrote: > > > I don't understand why Rob insists on something so clunky when > > there is no real need for it. > <snip> > With routine_id, you could create a lookup table of event handlers. <snip> > So while it turns out to be an inelegant solution for forward > references, it's a very flexible solution for callbacks. And also for modular code. I've made a lot of use in, eg., matheval and eusql for handling lots of different things using routine_id, where I have a main loop, and then the actual code for each case is contained in its own routine. To add new cases, I just add a new routine and add its id and condition to a couple of sequences that are referenced in the main loop. Matt Lewis