1. Re: Declaring a Function Before it is used

Phil Russel wrote:

> I don't understand why Rob insists on something so clunky when there is
> no real need for it.

At one point, Euphoria only supported a single callback. So all windows 
registered this routine as their callback, and it was the task of that 
routine to figure out how to respond to events.

With routine_id, you could create a lookup table of event handlers. That is:

   eventHandler[WINDOW][EVENT]

would hold the routine_id that handled the EVENT for WINDOW. This way, a 
single callback could be used my multiple windows by looking up the 
appropriate handler in the eventHandler dispatch table. This wouldn't have 
been possible with only forward references.

So while it turns out to be an inelegant solution for forward references, it's 
a very flexible solution for callbacks.

-- David Cuny

new topic     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu