Re: Declaring a Function Before it is used
- Posted by Derek Parnell <ddparnell at bigpond.com> Oct 29, 2003
- 373 views
> ----- Original Message ----- > From: Pete Lomax <petelomax at blueyonder.co.uk> > To: <EUforum at topica.com> > Sent: Tuesday, October 28, 2003 9:33 PM > Subject: Re: Declaring a Function Before it is used > > [snip] > > > > YES, there is a (valid) beef about this in this forum. > > However, it works, and Eu is fast(er) because of it. > > Is it a major problem? I would strongly argue for the value of routine_id(), but for reasons other than a means to implement forward referencing. And is forward referencing a real performance penalty? I would argue not. Firstly, Eu is already checking for the existance of the named routine when it parses routine call. To implement forward referencing (of routines) Eu only needs to act differently when it finds a routine name that it hasn't come across yet. Instead of crashing, Eu only needs to leave a place holder and add it to a 'fix-up' list. And when parsing a new routine definition, check the fix-up list to back poke in the new routine reference as required. Only one pass of the source code is required. The place holder could in fact be a reference to an built-in routine that causes the program to crash due to undefined routine name! Ok, so it might add a few milliseconds to the program start up - but who'd notice in any program that runs for more than a second? > > PS I would also sacrifice a little speed for ease of programming. > > However, I'm not walking away over this (minor) issue. Neither am I. Thankfully Euphoria got other things right enough for me to stick with it for now. -- Derek